Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I implemented some of the tests from the book. Some raw data from my computer:</p> <p>Test Run #1:</p> <p>TestIntegerAssignment 00:00:00.6680000<br> TestCallRoutineWithNoParameters 00:00:00.9780000<br> TestCallRoutineWithOneParameter 00:00:00.6580000<br> TestCallRoutineWithTwoParameters 00:00:00.9650000<br> TestIntegerAddition 00:00:00.6410000<br> TestIntegerSubtraction 00:00:00.9630000<br> TestIntegerMultiplication 00:00:00.6490000<br> TestIntegerDivision 00:00:00.9720000<br> TestFloatingPointDivision 00:00:00.6500000<br> TestFloatingPointSquareRoot 00:00:00.9790000<br> TestFloatingPointSine 00:00:00.6410000<br> TestFloatingPointLogarithm 00:00:41.1410000<br> TestFloatingPointExp 00:00:34.6310000 </p> <p>Test Run #2:</p> <p>TestIntegerAssignment 00:00:00.6750000<br> TestCallRoutineWithNoParameters 00:00:00.9720000<br> TestCallRoutineWithOneParameter 00:00:00.6490000<br> TestCallRoutineWithTwoParameters 00:00:00.9750000<br> TestIntegerAddition 00:00:00.6730000<br> TestIntegerSubtraction 00:00:01.0300000<br> TestIntegerMultiplication 00:00:00.7000000<br> TestIntegerDivision 00:00:01.1120000<br> TestFloatingPointDivision 00:00:00.6630000<br> TestFloatingPointSquareRoot 00:00:00.9860000<br> TestFloatingPointSine 00:00:00.6530000<br> TestFloatingPointLogarithm 00:00:39.1150000<br> TestFloatingPointExp 00:00:33.8730000 </p> <p>Test Run #3:</p> <p>TestIntegerAssignment 00:00:00.6590000<br> TestCallRoutineWithNoParameters 00:00:00.9700000<br> TestCallRoutineWithOneParameter 00:00:00.6680000<br> TestCallRoutineWithTwoParameters 00:00:00.9900000<br> TestIntegerAddition 00:00:00.6720000<br> TestIntegerSubtraction 00:00:00.9770000<br> TestIntegerMultiplication 00:00:00.6580000<br> TestIntegerDivision 00:00:00.9930000<br> TestFloatingPointDivision 00:00:00.6740000<br> TestFloatingPointSquareRoot 00:00:01.0120000<br> TestFloatingPointSine 00:00:00.6700000<br> TestFloatingPointLogarithm 00:00:39.1020000<br> TestFloatingPointExp 00:00:35.3560000 </p> <p>(1 Billion Tests Per Benchmark, Compiled with Optimize, AMD Athlon X2 3.0ghz, using Jon Skeet's microbenchmarking framework available at <a href="http://www.yoda.arachsys.com/csharp/benchmark.html" rel="noreferrer">http://www.yoda.arachsys.com/csharp/benchmark.html</a>)</p> <p>Source:</p> <pre><code>class TestBenchmark { [Benchmark] public static void TestIntegerAssignment() { int i = 1; int j = 2; for (int x = 0; x &lt; 1000000000; x++) { i = j; } } [Benchmark] public static void TestCallRoutineWithNoParameters() { for (int x = 0; x &lt; 1000000000; x++) { TestStaticRoutine(); } } [Benchmark] public static void TestCallRoutineWithOneParameter() { for (int x = 0; x &lt; 1000000000; x++) { TestStaticRoutine2(5); } } [Benchmark] public static void TestCallRoutineWithTwoParameters() { for (int x = 0; x &lt; 1000000000; x++) { TestStaticRoutine3(5,7); } } [Benchmark] public static void TestIntegerAddition() { int i = 1; int j = 2; int k = 3; for (int x = 0; x &lt; 1000000000; x++) { i = j + k; } } [Benchmark] public static void TestIntegerSubtraction() { int i = 1; int j = 6; int k = 3; for (int x = 0; x &lt; 1000000000; x++) { i = j - k; } } [Benchmark] public static void TestIntegerMultiplication() { int i = 1; int j = 2; int k = 3; for (int x = 0; x &lt; 1000000000; x++) { i = j * k; } } [Benchmark] public static void TestIntegerDivision() { int i = 1; int j = 6; int k = 3; for (int x = 0; x &lt; 1000000000; x++) { i = j/k; } } [Benchmark] public static void TestFloatingPointDivision() { float i = 1; float j = 6; float k = 3; for (int x = 0; x &lt; 1000000000; x++) { i = j / k; } } [Benchmark] public static void TestFloatingPointSquareRoot() { double x = 1; float y = 6; for (int x2 = 0; x2 &lt; 1000000000; x2++) { x = Math.Sqrt(6); } } [Benchmark] public static void TestFloatingPointSine() { double x = 1; float y = 6; for (int x2 = 0; x2 &lt; 1000000000; x2++) { x = Math.Sin(y); } } [Benchmark] public static void TestFloatingPointLogarithm() { double x = 1; float y = 6; for (int x2 = 0; x2 &lt; 1000000000; x2++) { x = Math.Log(y); } } [Benchmark] public static void TestFloatingPointExp() { double x = 1; float y = 6; for (int x2 = 0; x2 &lt; 1000000000; x2++) { x = Math.Exp(6); } } private static void TestStaticRoutine() { } private static void TestStaticRoutine2(int i) { } private static void TestStaticRoutine3(int i, int j) { } private static class TestStaticClass { } </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.
    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