-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubstitutionRenderBenchmarks.cs
More file actions
75 lines (66 loc) · 2.23 KB
/
Copy pathSubstitutionRenderBenchmarks.cs
File metadata and controls
75 lines (66 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Heddle.Performance.Runners;
namespace Heddle.Performance;
/// <summary>
/// Phase 5 trivial-substitution render head-to-head (spec D5/WI9), run with
/// <c>dotnet run -c Release -- --filter *SubstitutionRenderBenchmarks*</c>. One flat card whose
/// output is dominated by ten scalar member substitutions — no layout, components, or loop; the
/// shape where Heddle's composition advantage is expected to narrow or invert. All five engines
/// render raw and are parity-checked byte-identical in <see cref="Setup"/> before any timing.
/// Host-free (no Razor/DI).
/// </summary>
[MemoryDiagnoser]
public class SubstitutionRenderBenchmarks
{
private SubstitutionHeddleTest _heddleTest;
private SubstitutionFluidTest _fluidTest;
#if !NET6_0
private SubstitutionScribanTest _scribanTest;
#endif
private SubstitutionDotLiquidTest _dotLiquidTest;
private SubstitutionHandlebarsTest _handlebarsTest;
[GlobalSetup]
public void Setup()
{
_heddleTest = new SubstitutionHeddleTest();
_fluidTest = new SubstitutionFluidTest();
#if !NET6_0
_scribanTest = new SubstitutionScribanTest();
#endif
_dotLiquidTest = new SubstitutionDotLiquidTest();
_handlebarsTest = new SubstitutionHandlebarsTest();
// Every competitor twin must render output identical to Heddle (after the single documented
// normalization — a functional no-op here, the sources are whitespace-free) before we time
// anything, so a drifted twin fails loudly rather than benchmarking different work.
ParityCheck.AssertSubstitution();
}
// Heddle is the ratio baseline for the render suite.
[Benchmark(Baseline = true)]
public async Task RenderHeddle()
{
await _heddleTest.Run();
}
[Benchmark]
public async Task RenderFluid()
{
await _fluidTest.Run();
}
#if !NET6_0
[Benchmark]
public async Task RenderScriban()
{
await _scribanTest.Run();
}
#endif
[Benchmark]
public async Task RenderDotLiquid()
{
await _dotLiquidTest.Run();
}
[Benchmark]
public async Task RenderHandlebars()
{
await _handlebarsTest.Run();
}
}