Skip to content

Commit 4e254eb

Browse files
committed
bm updates
1 parent 0695e78 commit 4e254eb

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

README.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,20 @@ var expr = Expression.Lambda(
126126

127127
Compiling expression:
128128

129-
| Method | Mean | Error | StdDev | Median | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio |
130-
| ---------------------------- | --------: | --------: | --------: | --------: | ----: | ------: | -----: | -----: | --------: | ----------: |
131-
| Compile_SystemExpression | 89.076 us | 2.6699 us | 7.6605 us | 85.180 us | 28.12 | 3.05 | 0.7324 | 0.4883 | 4.74 KB | 3.41 |
132-
| CompileFast_SystemExpression | 3.138 us | 0.0550 us | 0.0565 us | 3.118 us | 0.99 | 0.03 | 0.2213 | 0.2136 | 1.39 KB | 1.00 |
133-
| CompileFast_LightExpression | 3.180 us | 0.0602 us | 0.0591 us | 3.163 us | 1.00 | 0.00 | 0.2213 | 0.2136 | 1.39 KB | 1.00 |
134-
129+
| Method | Mean | Error | StdDev | Ratio | RatioSD | Rank | Gen0 | Gen1 | Allocated | Alloc Ratio |
130+
| ---------------------------- | ---------: | --------: | --------: | ----: | ------: | ---: | -----: | -----: | --------: | ----------: |
131+
| CompileFast_LightExpression | 3.107 us | 0.0562 us | 0.0498 us | 0.99 | 0.02 | 1 | 0.1755 | 0.1678 | 1.08 KB | 1.00 |
132+
| CompileFast_SystemExpression | 3.126 us | 0.0288 us | 0.0256 us | 1.00 | 0.01 | 1 | 0.1755 | 0.1678 | 1.08 KB | 1.00 |
133+
| Compile_SystemExpression | 103.948 us | 1.9593 us | 2.5477 us | 33.26 | 0.84 | 2 | 0.7324 | 0.4883 | 4.74 KB | 4.40 |
135134

136135
Invoking the compiled delegate compared to the normal delegate and the direct call:
137136

138-
| Method | Mean | Error | StdDev | Median | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
139-
| ----------------------------- | -------: | --------: | --------: | -------: | ----: | ------: | -----: | --------: | ----------: |
140-
| DirectCall | 8.388 ns | 0.2655 ns | 0.7575 ns | 8.092 ns | 1.00 | 0.07 | 0.0051 | 32 B | 1.00 |
141-
| Compiled_SystemExpression | 9.474 ns | 0.1870 ns | 0.4105 ns | 9.381 ns | 1.10 | 0.05 | 0.0051 | 32 B | 1.00 |
142-
| CompiledFast_SystemExpression | 8.575 ns | 0.1624 ns | 0.1440 ns | 8.517 ns | 1.00 | 0.02 | 0.0051 | 32 B | 1.00 |
143-
| CompiledFast_LightExpression | 8.584 ns | 0.0776 ns | 0.0862 ns | 8.594 ns | 1.00 | 0.00 | 0.0051 | 32 B | 1.00 |
137+
| Method | Mean | Error | StdDev | Ratio | Rank | Gen0 | Allocated | Alloc Ratio |
138+
| ----------------------------- | -------: | -------: | -------: | ----: | ---: | -----: | --------: | ----------: |
139+
| DirectCall | 10.19 ns | 0.108 ns | 0.085 ns | 1.00 | 1 | 0.0051 | 32 B | 1.00 |
140+
| CompiledFast_LightExpression | 10.70 ns | 0.089 ns | 0.070 ns | 1.05 | 2 | 0.0051 | 32 B | 1.00 |
141+
| CompiledFast_SystemExpression | 10.91 ns | 0.071 ns | 0.066 ns | 1.07 | 2 | 0.0051 | 32 B | 1.00 |
142+
| Compiled_SystemExpression | 11.59 ns | 0.098 ns | 0.081 ns | 1.14 | 3 | 0.0051 | 32 B | 1.00 |
144143

145144

146145
### FastExpressionCompiler.LightExpression.Expression vs System.Linq.Expressions.Expression
@@ -168,11 +167,10 @@ Hopefully you are checking the expression arguments yourself and not waiting for
168167
169168
Creating the expression:
170169

171-
| Method | Mean | Error | StdDev | Median | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
172-
| -------------------------------------- | ---------: | -------: | -------: | ---------: | ----: | ------: | -----: | --------: | ----------: |
173-
| Create_SystemExpression | 1,110.9 ns | 22.19 ns | 62.23 ns | 1,086.1 ns | 7.25 | 0.56 | 0.2060 | 1304 B | 2.63 |
174-
| Create_LightExpression | 153.7 ns | 3.14 ns | 8.61 ns | 150.5 ns | 1.00 | 0.08 | 0.0789 | 496 B | 1.00 |
175-
| Create_LightExpression_with_intrinsics | 161.0 ns | 2.80 ns | 2.19 ns | 161.0 ns | 1.05 | 0.06 | 0.0777 | 488 B | 0.98 |
170+
| Method | Mean | Error | StdDev | Median | Ratio | RatioSD | Rank | Gen0 | Allocated | Alloc Ratio |
171+
| ----------------------- | ---------: | -------: | -------: | ---------: | ----: | ------: | ---: | -----: | --------: | ----------: |
172+
| Create_LightExpression | 156.6 ns | 3.19 ns | 8.18 ns | 151.9 ns | 1.00 | 0.07 | 1 | 0.0827 | 520 B | 1.00 |
173+
| Create_SystemExpression | 1,065.0 ns | 14.24 ns | 11.89 ns | 1,069.3 ns | 6.82 | 0.34 | 2 | 0.2060 | 1304 B | 2.51 |
176174

177175
Creating and compiling:
178176

test/FastExpressionCompiler.Benchmarks/LightExprVsExpr_CreateAndCompile_ComplexExpr.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public object Create_SystemExpression() =>
271271
public object Create_LightExpression() =>
272272
LightExpressionTests.CreateComplexLightExpression();
273273

274-
[Benchmark]
274+
// [Benchmark]
275275
public object Create_LightExpression_with_intrinsics() =>
276276
LightExpressionTests.CreateComplexLightExpression_with_intrinsics();
277277
}

test/FastExpressionCompiler.Benchmarks/ManuallyComposedLambdaBenchmark.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,22 +248,23 @@ .NET SDK 9.0.203
248248
| CompileFast_SystemExpression | 3.190 us | 0.0519 us | 0.0485 us | 0.97 | 0.02 | 1 | 0.1755 | 0.1678 | 1.08 KB | 1.00 |
249249
| CompileFast_LightExpression | 3.300 us | 0.0633 us | 0.0650 us | 1.00 | 0.03 | 1 | 0.1755 | 0.1678 | 1.08 KB | 1.00 |
250250
| Compile_SystemExpression | 106.339 us | 2.1083 us | 4.1120 us | 32.24 | 1.38 | 2 | 0.7324 | 0.6104 | 4.74 KB | 4.40 |
251+
251252
*/
252253

253254
[Benchmark]
254255
public Func<B, X> Compile_SystemExpression() =>
255256
_expr.Compile();
256257

257-
[Benchmark]
258+
[Benchmark(Baseline = true)]
258259
public Func<B, X> CompileFast_SystemExpression() =>
259260
_expr.CompileFast(true);
260261

261-
[Benchmark(Baseline = true)]
262+
[Benchmark]
262263
public Func<B, X> CompileFast_LightExpression() =>
263264
LightExpression.ExpressionCompiler.CompileFast(_leExpr, true);
264265
}
265266

266-
[MemoryDiagnoser]
267+
[MemoryDiagnoser, RankColumn, Orderer(BenchmarkDotNet.Order.SummaryOrderPolicy.FastestToSlowest)]
267268
public class Invocation
268269
{
269270
/*
@@ -338,7 +339,7 @@ public class Invocation
338339
private static readonly B _bb = new B();
339340
private static readonly Func<B, X> _lambda = b => new X(_aa, b);
340341

341-
[Benchmark]
342+
[Benchmark(Baseline = true)]
342343
public X DirectCall() => _lambda(_bb);
343344

344345
[Benchmark]
@@ -347,7 +348,7 @@ public class Invocation
347348
[Benchmark]
348349
public X CompiledFast_SystemExpression() => _lambdaCompiledFast(_bb);
349350

350-
[Benchmark(Baseline = true)]
351+
[Benchmark]
351352
public X CompiledFast_LightExpression() => _lambdaCompiledFast_LightExpession(_bb);
352353
}
353354
}

test/FastExpressionCompiler.Benchmarks/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ public static void Main()
1313
// BenchmarkRunner.Run<HoistedLambdaBenchmark.Invocation>();
1414

1515
// BenchmarkRunner.Run<HoistedLambdaWithNestedLambdaBenchmark.Compilation>();
16-
BenchmarkRunner.Run<HoistedLambdaWithNestedLambdaBenchmark.Invocation>();
16+
// BenchmarkRunner.Run<HoistedLambdaWithNestedLambdaBenchmark.Invocation>();
1717

1818
// BenchmarkRunner.Run<ManuallyComposedLambdaBenchmark.Compilation>();
1919
// BenchmarkRunner.Run<ManuallyComposedLambdaBenchmark.Invocation>();
2020
// BenchmarkRunner.Run<ManuallyComposedLambdaBenchmark.Create>(); // not included in README.md, may be it needs to
2121
// BenchmarkRunner.Run<ManuallyComposedLambdaBenchmark.Create_and_Compile>(); // not included in README.md, may be it needs to
2222

2323
// BenchmarkRunner.Run<LightExprVsExpr_Create_ComplexExpr>();
24-
// BenchmarkRunner.Run<LightExprVsExpr_CreateAndCompile_ComplexExpr>();
24+
BenchmarkRunner.Run<LightExprVsExpr_CreateAndCompile_ComplexExpr>();
2525

2626
//--------------------------------------------
2727

0 commit comments

Comments
 (0)