The problem is that Azodious is mentioned, you cannot use debug mode to measure time, because it will be inaccurate.
In release mode, I get the following numbers:
Increment k : 445
NOP : 402
In the incremental version, there are 4 more IL commands:
IL_0001: ldc.i4.0 IL_0002: stloc.0 IL_0003: ldc.i4.0 IL_0004: stloc.1 IL_0005: br.s IL_003B IL_0007: ldc.i4.0 IL_0008: stloc.2 IL_0009: br.s IL_0029 IL_000B: ldc.i4.0 IL_000C: stloc.3 IL_000D: br.s IL_0017 IL_000F: ldloc.0 IL_0010: ldc.i4.1 IL_0011: add IL_0012: stloc.0 IL_0013: ldloc.3 IL_0014: ldc.i4.1 IL_0015: add IL_0016: stloc.3 IL_0017: ldloc.3 IL_0018: ldc.i4 E8 03 00 00 IL_001D: clt IL_001F: stloc.s 04 IL_0021: ldloc.s 04 IL_0023: brtrue.s IL_000F IL_0025: ldloc.2 IL_0026: ldc.i4.1 IL_0027: add IL_0028: stloc.2 IL_0029: ldloc.2 IL_002A: ldc.i4 E8 03 00 00 IL_002F: clt IL_0031: stloc.s 04 IL_0033: ldloc.s 04 IL_0035: brtrue.s IL_000B IL_0037: ldloc.1 IL_0038: ldc.i4.1 IL_0039: add IL_003A: stloc.1 IL_003B: ldloc.1 IL_003C: ldc.i4 E8 03 00 00 IL_0041: clt IL_0043: stloc.s 04 IL_0045: ldloc.s 04 IL_0047: brtrue.s IL_0007
NOP -verison has an equal number of branches, but fewer add :
IL_0001: ldc.i4.0 IL_0002: stloc.0 IL_0003: ldc.i4.0 IL_0004: stloc.1 IL_0005: br.s IL_0037 IL_0007: ldc.i4.0 IL_0008: stloc.2 IL_0009: br.s IL_0025 IL_000B: ldc.i4.0 IL_000C: stloc.3 IL_000D: br.s IL_0013 IL_000F: ldloc.3 IL_0010: ldc.i4.1 IL_0011: add IL_0012: stloc.3 IL_0013: ldloc.3 IL_0014: ldc.i4 E8 03 00 00 IL_0019: clt IL_001B: stloc.s 04 IL_001D: ldloc.s 04 IL_001F: brtrue.s IL_000F IL_0021: ldloc.2 IL_0022: ldc.i4.1 IL_0023: add IL_0024: stloc.2 IL_0025: ldloc.2 IL_0026: ldc.i4 E8 03 00 00 IL_002B: clt IL_002D: stloc.s 04 IL_002F: ldloc.s 04 IL_0031: brtrue.s IL_000B IL_0033: ldloc.1 IL_0034: ldc.i4.1 IL_0035: add IL_0036: stloc.1 IL_0037: ldloc.1 IL_0038: ldc.i4 E8 03 00 00 IL_003D: clt IL_003F: stloc.s 04 IL_0041: ldloc.s 04 IL_0043: brtrue.s IL_0007
They are compiled without optimization, because I want to see exactly what is happening.
The only difference between them in reality:
IL_0012: stloc.0 IL_0013: ldloc.3 IL_0014: ldc.i4.1 IL_0015: add
Simply put: you get weird numbers because you are in debug mode.
source share