Skip to content

Instantly share code, notes, and snippets.

@Trapov
Created May 5, 2019 11:44
Show Gist options
  • Save Trapov/882609c46ca955d9605782c409b6d0fd to your computer and use it in GitHub Desktop.
Save Trapov/882609c46ca955d9605782c409b6d0fd to your computer and use it in GitHub Desktop.
ForVsForeach-Results
BenchmarkDotNet=v0.11.5, OS=Windows 10.0.17763.475 (1809/October2018Update/Redstone5)
AMD A4-6300 APU with Radeon(tm) HD Graphics, 1 CPU, 2 logical cores and 1 physical core
.NET Core SDK=2.2.104
  [Host] : .NET Core 2.2.2 (CoreCLR 4.6.27317.07, CoreFX 4.6.27318.02), 64bit RyuJIT
  Core   : .NET Core 2.2.2 (CoreCLR 4.6.27317.07, CoreFX 4.6.27318.02), 64bit RyuJIT

Job=Core  Runtime=Core  
Method N Mean Error StdDev Median Rank Gen 0 Gen 1 Gen 2 Allocated
Foreach 100 690.6 ns 13.67 ns 31.42 ns 676.7 ns 2 0.8383 - - 440 B
For 100 676.1 ns 23.87 ns 70.37 ns 659.9 ns 1 0.8383 - - 440 B
Foreach 10000 61,301.1 ns 887.67 ns 830.33 ns 61,479.4 ns 4 62.3779 - - 33120 B
For 10000 47,219.6 ns 210.17 ns 196.59 ns 47,288.2 ns 3 62.4390 - - 33120 B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment