Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Interestingly, I passed on feedback about operator support via <code>dynamic</code> being an order-of-magnitude slower for <code>Nullable&lt;T&gt;</code> (similar to <a href="http://social.msdn.microsoft.com/Forums/en-US/vs2010ctpvbcs/thread/287db1b9-c135-40bc-a1c5-a8a51efbfc65" rel="noreferrer">this early test</a>) - I suspect for very similar reasons.</p> <p>Gotta love <code>Nullable&lt;T&gt;</code>. Another fun one is that even though the JIT spots (and removes) <code>null</code> for non-nullable structs, it borks it for <code>Nullable&lt;T&gt;</code>:</p> <pre><code>using System; using System.Diagnostics; static class Program { static void Main() { // JIT TestUnrestricted&lt;int&gt;(1,5); TestUnrestricted&lt;string&gt;("abc",5); TestUnrestricted&lt;int?&gt;(1,5); TestNullable&lt;int&gt;(1, 5); const int LOOP = 100000000; Console.WriteLine(TestUnrestricted&lt;int&gt;(1, LOOP)); Console.WriteLine(TestUnrestricted&lt;string&gt;("abc", LOOP)); Console.WriteLine(TestUnrestricted&lt;int?&gt;(1, LOOP)); Console.WriteLine(TestNullable&lt;int&gt;(1, LOOP)); } static long TestUnrestricted&lt;T&gt;(T x, int loop) { Stopwatch watch = Stopwatch.StartNew(); int count = 0; for (int i = 0; i &lt; loop; i++) { if (x != null) count++; } watch.Stop(); return watch.ElapsedMilliseconds; } static long TestNullable&lt;T&gt;(T? x, int loop) where T : struct { Stopwatch watch = Stopwatch.StartNew(); int count = 0; for (int i = 0; i &lt; loop; i++) { if (x != null) count++; } watch.Stop(); return watch.ElapsedMilliseconds; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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