Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Use a background worker and read only a limited number of lines. Read more only when the user scrolls.</p> <p>And try to never use ReadToEnd(). It's one of the functions that you think "why did they make it?"; it's a <a href="https://en.wikipedia.org/wiki/Script_kiddie" rel="nofollow noreferrer">script kiddies'</a> helper that goes fine with small things, but as you see, it sucks for large files...</p> <p>Those guys telling you to use StringBuilder need to read the MSDN more often:</p> <p><em>Performance Considerations<br /> The Concat and AppendFormat methods both concatenate new data to an existing String or StringBuilder object. A String object concatenation operation always creates a new object from the existing string and the new data. A StringBuilder object maintains a buffer to accommodate the concatenation of new data. New data is appended to the end of the buffer if room is available; otherwise, a new, larger buffer is allocated, data from the original buffer is copied to the new buffer, then the new data is appended to the new buffer. The performance of a concatenation operation for a String or StringBuilder object depends on how often a memory allocation occurs. <br /> A String concatenation operation always allocates memory, whereas a StringBuilder concatenation operation only allocates memory if the StringBuilder object buffer is too small to accommodate the new data. Consequently, the String class is preferable for a concatenation operation if a fixed number of String objects are concatenated. In that case, the individual concatenation operations might even be combined into a single operation by the compiler. A StringBuilder object is preferable for a concatenation operation if an arbitrary number of strings are concatenated; for example, if a loop concatenates a random number of strings of user input.</em></p> <p>That means <strong>huge</strong> allocation of memory, what becomes large use of swap files system, that simulates sections of your hard disk drive to act like the RAM memory, but a hard disk drive is very slow.</p> <p>The StringBuilder option looks fine for who use the system as a mono-user, but when you have two or more users reading large files at the same time, you have a problem.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload