Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Most of these entities take only a single character, yet you are storing them as strings. The reference pointer to those string <em>alone</em> is going to take <em>at least</em> twice as much space (in case of UTF8 likely 4-8 times as much). Then there is the overhead of keeping a hash table structured for the dictionary.</p> <p>The <code>List&lt;&gt;</code> in itself should be really efficient storage wise (it uses an array internally)</p> <p><strong>Room for improvement</strong>:</p> <ul> <li>you could use <code>List&lt;char&gt;</code> or <code>char[]</code> instead of <code>List&lt;string&gt;</code> if you know that the fields will fit</li> <li>you could use <code>struct Field { char a,b/*,...*/; }</code> and List instead of List if you need more than 1 character per field</li> <li><p>You could <strong>forgo the eager field extraction</strong> [&lt;-- recommended]: </p> <pre><code> var dict = File.ReadAllLines(file) .ToDictionary(line =&gt; line.Split(',')[27]); </code></pre> <p>This gives you the opportunity to access the compareElements on demand:</p> <pre><code> string[] compareElements = dicts["key27"].Split(',')/*.Take(24).ToArray()*/; </code></pre> <p>This is a classic example of runtime/storage cost trade-off</p></li> </ul> <p><strong>Edit</strong> an obvious hybrid would be:</p> <pre><code>struct AllCompareElements { public char field1, field2, ... field24; // perhaps: public char[2] field13; // for the exceptional field that is longer than 1 character } </code></pre> <p>Happily employ Resharper to implement <code>Equals</code>, <code>GetHashCode</code>, <code>IEquatable&lt;AllCompareElements&gt;</code>, <code>IComparable&lt;AllCompareElements&gt;</code></p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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