Advertisement
Guest User

C# strange struct performance IL

a guest
Jun 3rd, 2017
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.48 KB | None | 0 0
  1. // Type: Program
  2. // Assembly: NumericsCSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
  3. // MVID: 96936848-6B89-42E9-9BE9-B86DE1CDABA6
  4. // Location: NumericsCSharp\bin\Release\NumericsCSharp.exe
  5. // Sequence point data from NumericsCSharp\bin\Release\NumericsCSharp.pdb
  6.  
  7. .class private auto ansi beforefieldinit
  8.   Program
  9.     extends [mscorlib]System.Object
  10. {
  11.  
  12.   .method private hidebysig static void
  13.     Main(
  14.       string[] args
  15.     ) cil managed
  16.   {
  17.     .entrypoint
  18.     .maxstack 3
  19.     .locals init (
  20.       [0] class [System]System.Diagnostics.Stopwatch sw,
  21.       [1] int32 iterationCount,
  22.       [2] float32 totalwu,
  23.       [3] float32 total,
  24.       [4] valuetype Vector1 totalV,
  25.       [5] valuetype Vector1Magic totalVM,
  26.       [6] int32 i,
  27.       [7] float32 v,
  28.       [8] int32 i,
  29.       [9] float32 v,
  30.       [10] int32 i,
  31.       [11] valuetype Vector1 v,
  32.       [12] int32 i,
  33.       [13] valuetype Vector1Magic vm
  34.     )
  35.  
  36.     // [43 3 - 43 28]
  37.     IL_0000: newobj       instance void [System]System.Diagnostics.Stopwatch::.ctor()
  38.     IL_0005: stloc.0      // sw
  39.  
  40.     // [44 3 - 44 14]
  41.     IL_0006: ldloc.0      // sw
  42.     IL_0007: callvirt     instance void [System]System.Diagnostics.Stopwatch::Start()
  43.  
  44.     // [45 3 - 45 35]
  45.     IL_000c: ldc.i4       1000000000 // 0x3b9aca00
  46.     IL_0011: stloc.1      // iterationCount
  47.  
  48.     // [46 3 - 46 22]
  49.     IL_0012: ldc.r4       0.0
  50.     IL_0017: stloc.2      // totalwu
  51.  
  52.     // [50 8 - 50 17]
  53.     IL_0018: ldc.i4.0    
  54.     IL_0019: stloc.s      i
  55.  
  56.     IL_001b: br.s         IL_002d
  57.     // start of loop, entry point: IL_002d
  58.  
  59.       // [51 4 - 51 22]
  60.       IL_001d: ldloc.s      i
  61.       IL_001f: conv.r4      
  62.       IL_0020: stloc.s      v
  63.  
  64.       // [52 4 - 52 26]
  65.       IL_0022: ldloc.2      // totalwu
  66.       IL_0023: ldloc.s      v
  67.       IL_0025: add          
  68.       IL_0026: stloc.2      // totalwu
  69.  
  70.       // [50 39 - 50 42]
  71.       IL_0027: ldloc.s      i
  72.       IL_0029: ldc.i4.1    
  73.       IL_002a: add          
  74.       IL_002b: stloc.s      i
  75.  
  76.       // [50 19 - 50 37]
  77.       IL_002d: ldloc.s      i
  78.       IL_002f: ldloc.1      // iterationCount
  79.       IL_0030: blt.s        IL_001d
  80.     // end of loop
  81.  
  82.     // [54 3 - 54 13]
  83.     IL_0032: ldloc.0      // sw
  84.     IL_0033: callvirt     instance void [System]System.Diagnostics.Stopwatch::Stop()
  85.  
  86.     // [55 3 - 55 14]
  87.     IL_0038: ldloc.0      // sw
  88.     IL_0039: callvirt     instance void [System]System.Diagnostics.Stopwatch::Reset()
  89.  
  90.     // [56 3 - 56 14]
  91.     IL_003e: ldloc.0      // sw
  92.     IL_003f: callvirt     instance void [System]System.Diagnostics.Stopwatch::Start()
  93.  
  94.     // [57 3 - 57 20]
  95.     IL_0044: ldc.r4       0.0
  96.     IL_0049: stloc.3      // total
  97.  
  98.     // [58 8 - 58 17]
  99.     IL_004a: ldc.i4.0    
  100.     IL_004b: stloc.s      i
  101.  
  102.     IL_004d: br.s         IL_005f
  103.     // start of loop, entry point: IL_005f
  104.  
  105.       // [59 4 - 59 22]
  106.       IL_004f: ldloc.s      i
  107.       IL_0051: conv.r4      
  108.       IL_0052: stloc.s      v
  109.  
  110.       // [60 4 - 60 22]
  111.       IL_0054: ldloc.3      // total
  112.       IL_0055: ldloc.s      v
  113.       IL_0057: add          
  114.       IL_0058: stloc.3      // total
  115.  
  116.       // [58 39 - 58 42]
  117.       IL_0059: ldloc.s      i
  118.       IL_005b: ldc.i4.1    
  119.       IL_005c: add          
  120.       IL_005d: stloc.s      i
  121.  
  122.       // [58 19 - 58 37]
  123.       IL_005f: ldloc.s      i
  124.       IL_0061: ldloc.1      // iterationCount
  125.       IL_0062: blt.s        IL_004f
  126.     // end of loop
  127.  
  128.     // [62 3 - 62 13]
  129.     IL_0064: ldloc.0      // sw
  130.     IL_0065: callvirt     instance void [System]System.Diagnostics.Stopwatch::Stop()
  131.  
  132.     // [63 3 - 63 91]
  133.     IL_006a: ldstr        "Float time was {0} for {1} iterations."
  134.     IL_006f: ldloc.0      // sw
  135.     IL_0070: callvirt     instance valuetype [mscorlib]System.TimeSpan [System]System.Diagnostics.Stopwatch::get_Elapsed()
  136.     IL_0075: box          [mscorlib]System.TimeSpan
  137.     IL_007a: ldloc.1      // iterationCount
  138.     IL_007b: box          [mscorlib]System.Int32
  139.     IL_0080: call         void [mscorlib]System.Console::WriteLine(string, object, object)
  140.  
  141.     // [64 3 - 64 14]
  142.     IL_0085: ldloc.0      // sw
  143.     IL_0086: callvirt     instance void [System]System.Diagnostics.Stopwatch::Reset()
  144.  
  145.     // [65 3 - 65 14]
  146.     IL_008b: ldloc.0      // sw
  147.     IL_008c: callvirt     instance void [System]System.Diagnostics.Stopwatch::Start()
  148.  
  149.     // [66 3 - 66 34]
  150.     IL_0091: ldloca.s     totalV
  151.     IL_0093: ldc.r4       0.0
  152.     IL_0098: call         instance void Vector1::.ctor(float32)
  153.  
  154.     // [67 8 - 67 17]
  155.     IL_009d: ldc.i4.0    
  156.     IL_009e: stloc.s      i
  157.  
  158.     IL_00a0: br.s         IL_00bd
  159.     // start of loop, entry point: IL_00bd
  160.  
  161.       // [68 4 - 68 27]
  162.       IL_00a2: ldloca.s     v
  163.       IL_00a4: ldloc.s      i
  164.       IL_00a6: conv.r4      
  165.       IL_00a7: call         instance void Vector1::.ctor(float32)
  166.  
  167.       // [69 4 - 69 16]
  168.       IL_00ac: ldloc.s      totalV
  169.       IL_00ae: ldloc.s      v
  170.       IL_00b0: call         valuetype Vector1 Vector1::op_Addition(valuetype Vector1, valuetype Vector1)
  171.       IL_00b5: stloc.s      totalV
  172.  
  173.       // [67 39 - 67 42]
  174.       IL_00b7: ldloc.s      i
  175.       IL_00b9: ldc.i4.1    
  176.       IL_00ba: add          
  177.       IL_00bb: stloc.s      i
  178.  
  179.       // [67 19 - 67 37]
  180.       IL_00bd: ldloc.s      i
  181.       IL_00bf: ldloc.1      // iterationCount
  182.       IL_00c0: blt.s        IL_00a2
  183.     // end of loop
  184.  
  185.     // [71 3 - 71 13]
  186.     IL_00c2: ldloc.0      // sw
  187.     IL_00c3: callvirt     instance void [System]System.Diagnostics.Stopwatch::Stop()
  188.  
  189.     // [72 3 - 72 93]
  190.     IL_00c8: ldstr        "Vector1 time was {0} for {1} iterations."
  191.     IL_00cd: ldloc.0      // sw
  192.     IL_00ce: callvirt     instance valuetype [mscorlib]System.TimeSpan [System]System.Diagnostics.Stopwatch::get_Elapsed()
  193.     IL_00d3: box          [mscorlib]System.TimeSpan
  194.     IL_00d8: ldloc.1      // iterationCount
  195.     IL_00d9: box          [mscorlib]System.Int32
  196.     IL_00de: call         void [mscorlib]System.Console::WriteLine(string, object, object)
  197.  
  198.     // [73 3 - 73 14]
  199.     IL_00e3: ldloc.0      // sw
  200.     IL_00e4: callvirt     instance void [System]System.Diagnostics.Stopwatch::Reset()
  201.  
  202.     // [74 3 - 74 14]
  203.     IL_00e9: ldloc.0      // sw
  204.     IL_00ea: callvirt     instance void [System]System.Diagnostics.Stopwatch::Start()
  205.  
  206.     // [75 3 - 75 40]
  207.     IL_00ef: ldloca.s     totalVM
  208.     IL_00f1: ldc.r4       0.0
  209.     IL_00f6: call         instance void Vector1Magic::.ctor(float32)
  210.  
  211.     // [76 8 - 76 17]
  212.     IL_00fb: ldc.i4.0    
  213.     IL_00fc: stloc.s      i
  214.  
  215.     IL_00fe: br.s         IL_011b
  216.     // start of loop, entry point: IL_011b
  217.  
  218.       // [77 4 - 77 33]
  219.       IL_0100: ldloca.s     vm
  220.       IL_0102: ldloc.s      i
  221.       IL_0104: conv.r4      
  222.       IL_0105: call         instance void Vector1Magic::.ctor(float32)
  223.  
  224.       // [78 4 - 78 18]
  225.       IL_010a: ldloc.s      totalVM
  226.       IL_010c: ldloc.s      vm
  227.       IL_010e: call         valuetype Vector1Magic Vector1Magic::op_Addition(valuetype Vector1Magic, valuetype Vector1Magic)
  228.       IL_0113: stloc.s      totalVM
  229.  
  230.       // [76 39 - 76 42]
  231.       IL_0115: ldloc.s      i
  232.       IL_0117: ldc.i4.1    
  233.       IL_0118: add          
  234.       IL_0119: stloc.s      i
  235.  
  236.       // [76 19 - 76 37]
  237.       IL_011b: ldloc.s      i
  238.       IL_011d: ldloc.1      // iterationCount
  239.       IL_011e: blt.s        IL_0100
  240.     // end of loop
  241.  
  242.     // [80 3 - 80 13]
  243.     IL_0120: ldloc.0      // sw
  244.     IL_0121: callvirt     instance void [System]System.Diagnostics.Stopwatch::Stop()
  245.  
  246.     // [81 3 - 81 98]
  247.     IL_0126: ldstr        "Vector1Magic time was {0} for {1} iterations."
  248.     IL_012b: ldloc.0      // sw
  249.     IL_012c: callvirt     instance valuetype [mscorlib]System.TimeSpan [System]System.Diagnostics.Stopwatch::get_Elapsed()
  250.     IL_0131: box          [mscorlib]System.TimeSpan
  251.     IL_0136: ldloc.1      // iterationCount
  252.     IL_0137: box          [mscorlib]System.Int32
  253.     IL_013c: call         void [mscorlib]System.Console::WriteLine(string, object, object)
  254.  
  255.     // [82 3 - 82 18]
  256.     IL_0141: call         int32 [mscorlib]System.Console::Read()
  257.     IL_0146: pop          
  258.  
  259.     // [90 2 - 90 3]
  260.     IL_0147: ret          
  261.  
  262.   } // end of method Program::Main
  263.  
  264.   .method public hidebysig specialname rtspecialname instance void
  265.     .ctor() cil managed
  266.   {
  267.     .maxstack 8
  268.  
  269.     IL_0000: ldarg.0      // this
  270.     IL_0001: call         instance void [mscorlib]System.Object::.ctor()
  271.     IL_0006: ret          
  272.  
  273.   } // end of method Program::.ctor
  274. } // end of class Program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement