Skip to content

Commit e13cb69

Browse files
committed
Except: add one case in benchmark.
1 parent 82819e0 commit e13cb69

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

Documents/BenchmarksResults/Except.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
``` ini
88

99
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
10-
Intel Core i7-8750H CPU 2.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
11-
.NET Core SDK=5.0.101
12-
[Host] : .NET Core 5.0.1 (CoreCLR 5.0.120.57516, CoreFX 5.0.120.57516), X64 RyuJIT
13-
DefaultJob : .NET Core 5.0.1 (CoreCLR 5.0.120.57516, CoreFX 5.0.120.57516), X64 RyuJIT
10+
Intel Core i7-7700 CPU 3.60GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cores
11+
.NET Core SDK=5.0.202
12+
[Host] : .NET Core 5.0.5 (CoreCLR 5.0.521.16609, CoreFX 5.0.521.16609), X64 RyuJIT
13+
DefaultJob : .NET Core 5.0.5 (CoreCLR 5.0.521.16609, CoreFX 5.0.521.16609), X64 RyuJIT
1414

1515

1616
```
17-
| Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
18-
|------------------------------- |---------:|--------:|--------:|------:|--------:|--------:|--------:|----------:|
19-
| Linq | 331.1 μs | 1.51 μs | 1.41 μs | 1.00 | 90.8203 | 90.8203 | 90.8203 | 524848 B |
20-
| StructLinq | 142.5 μs | 0.68 μs | 0.63 μs | 0.43 | - | - | - | 64 B |
21-
| StructLinqZeroAlloc | 155.3 μs | 0.60 μs | 0.53 μs | 0.47 | - | - | - | - |
22-
| StructLinqZeroAllocAndComparer | 118.3 μs | 0.29 μs | 0.25 μs | 0.36 | - | - | - | - |
17+
| Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
18+
|---------------------------------- |---------:|--------:|--------:|------:|--------:|--------:|--------:|----------:|
19+
| Linq | 405.5 μs | 4.10 μs | 3.64 μs | 1.00 | 90.8203 | 90.8203 | 90.8203 | 524848 B |
20+
| StructLinq | 169.1 μs | 1.25 μs | 1.05 μs | 0.42 | - | - | - | 64 B |
21+
| StructLinqZeroAlloc | 169.5 μs | 1.44 μs | 1.28 μs | 0.42 | - | - | - | - |
22+
| StructLinqZeroAllocAndComparer | 148.6 μs | 0.81 μs | 0.76 μs | 0.37 | - | - | - | - |
23+
| StructLinqZeroAllocAndComparerSum | 129.5 μs | 0.62 μs | 0.52 μs | 0.32 | - | - | - | - |

src/StructLinq.Benchmark/Except.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,14 @@ public int StructLinqZeroAllocAndComparer()
6363
return sum;
6464
}
6565

66+
[Benchmark]
67+
public int StructLinqZeroAllocAndComparerSum()
68+
{
69+
var comparer = new DefaultStructEqualityComparer();
70+
return array1.ToStructEnumerable()
71+
.Except(array2.ToStructEnumerable(), comparer, x => x, x => x)
72+
.Sum(x=>x);
73+
}
74+
6675
}
6776
}

0 commit comments

Comments
 (0)