Created
February 4, 2021 11:48
-
-
Save badamczewski/c62492b000ef68fa73eb1db3e2eefe3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [DisassemblyDiagnoser(maxDepth:2, printSource:true)] | |
| public class Bench5 | |
| { | |
| public int[] a = new int[1024]; | |
| public int size = 1024; | |
| [GlobalSetup] | |
| public void Setup() | |
| { | |
| //for (int i = 0; i < size; i++) | |
| // a[i] = i; | |
| } | |
| [Benchmark(Baseline = true)] | |
| [Arguments(10,10)] | |
| [MethodImpl(MethodImplOptions.AggressiveOptimization)] | |
| public void Loop_Size_Global(int x, int y) | |
| { | |
| for (int i = 0; i < size; i++) | |
| a[i] = x + y; | |
| } | |
| [Benchmark] | |
| [Arguments(10, 10)] | |
| [MethodImpl(MethodImplOptions.AggressiveOptimization)] | |
| public void Loop_Size_Local(int x, int y) | |
| { | |
| int sizeLocal = size; | |
| for (int i = 0; i < 1024; i++) | |
| a[i] = x + y; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment