Skip to content

Instantly share code, notes, and snippets.

@aalmada
Created August 18, 2020 19:48
Show Gist options
  • Save aalmada/dda33bbf6b1b4cb7e105a90cfff1e825 to your computer and use it in GitHub Desktop.
Save aalmada/dda33bbf6b1b4cb7e105a90cfff1e825 to your computer and use it in GitHub Desktop.

Array.Int32.ArrayInt32WhereCount

References:

Results:

BenchmarkDotNet=v0.12.1, OS=macOS Catalina 10.15.6 (19G2021) [Darwin 19.6.0]
Intel Core i5-7360U CPU 2.30GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=5.0.100-preview.6.20318.15
  [Host]        : .NET Core 5.0.0 (CoreCLR 5.0.20.30506, CoreFX 5.0.20.30506), X64 RyuJIT
  .NET Core 5.0 : .NET Core 5.0.0 (CoreCLR 5.0.20.30506, CoreFX 5.0.20.30506), X64 RyuJIT

Job=.NET Core 5.0  Runtime=.NET Core 5.0  
Method Categories Count Mean Error StdDev Median Ratio RatioSD Gen 0 Gen 1 Gen 2 Allocated
ForLoop Sequential 100000 76,481.03 ns 202.635 ns 179.630 ns 76,446.95 ns 1.00 0.00 - - - -
ForeachLoop Sequential 100000 76,333.75 ns 180.491 ns 150.718 ns 76,260.33 ns 1.00 0.00 - - - -
Linq Sequential 100000 660,622.54 ns 1,152.558 ns 1,078.104 ns 660,620.24 ns 8.64 0.02 - - - 32 B
LinqFaster Sequential 100000 237,254.27 ns 568.295 ns 503.779 ns 237,300.19 ns 3.10 0.01 - - - -
LinqAF Sequential 100000 232,853.28 ns 2,236.511 ns 2,092.034 ns 232,379.99 ns 3.05 0.03 - - - -
StructLinq Sequential 100000 325,957.23 ns 765.202 ns 715.770 ns 325,887.99 ns 4.26 0.02 - - - 40 B
StructLinq_IFunction Sequential 100000 155,249.48 ns 227.858 ns 201.991 ns 155,213.89 ns 2.03 0.01 - - - 40 B
Hyperlinq Sequential 100000 169,677.97 ns 459.866 ns 407.660 ns 169,474.68 ns 2.22 0.01 - - - -
ForLoop Random 100000 390,143.19 ns 410.778 ns 343.018 ns 390,077.55 ns 5.10 0.01 - - - -
ForeachLoop Random 100000 390,220.21 ns 932.595 ns 826.722 ns 390,087.92 ns 5.10 0.02 - - - -
Linq Random 100000 1,064,579.81 ns 3,309.107 ns 3,095.340 ns 1,063,814.27 ns 13.91 0.04 - - - 32 B
LinqFaster Random 100000 511,973.79 ns 2,790.495 ns 2,330.189 ns 511,583.67 ns 6.70 0.03 - - - -
LinqAF Random 100000 508,572.40 ns 492.565 ns 436.646 ns 508,503.58 ns 6.65 0.02 - - - 10 B
StructLinq Random 100000 766,906.42 ns 3,017.787 ns 2,822.840 ns 765,282.88 ns 10.03 0.05 - - - 40 B
StructLinq_IFunction Random 100000 632,653.58 ns 636.328 ns 564.088 ns 632,614.62 ns 8.27 0.02 - - - 40 B
Hyperlinq Random 100000 169,650.69 ns 296.853 ns 277.677 ns 169,619.92 ns 2.22 0.00 - - - -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment