Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>About the only other idea I could come up with, if you really want to keep your memory usage down, would be store the dictionary in a stream and compress it. Factors to consider would be how often you're accessing/inflating this data, and how compressible the data is. Text from newspaper articles would compress extremely well, and the performance hit might be less than you'd think. </p> <p>Using an open-source library like SharpZipLib ( <a href="http://www.icsharpcode.net/opensource/sharpziplib/" rel="nofollow">http://www.icsharpcode.net/opensource/sharpziplib/</a> ), your code would look something like:</p> <pre><code>MemoryStream stream = new MemoryStream(); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, ListaDigramas); byte[] dictBytes = stream.ToArray(); Stream zipStream = new DeflaterOutputStream(new MemoryStream()); zipStream.Write(dictBytes, 0, dictBytes.Length); </code></pre> <p>Inflating requires an <code>InflaterInputStream</code> and a loop to inflate the stream in chunks, but is fairly straightforward.</p> <p>You'd have to play with the app to see if performance was acceptable. Keeping in mind, of course, that you'll still need enough memory to hold the dictionary when you inflate it for use (unless someone has a clever idea to work with the object in its compressed state).</p> <p>Honestly, though, keeping it as-is in memory and letting Windows swap it to the page file is probably your best/fastest option.</p> <p><strong>Edit</strong><br/> I've never tried it, but you might be able to serialize directly to the compression stream, meaning the compression overhead is minimal (you'd still have the serialization overhead):</p> <pre><code>MemoryStream stream = new MemoryStream(); BinaryFormatter formatter = new BinaryFormatter(); Stream zipStream = new DeflaterOutputStream(new MemoryStream()); formatter.Serialize(zipStream, ListaDigramas); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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