-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoopRenderBenchmarks.cs
More file actions
74 lines (65 loc) · 2.09 KB
/
Copy pathLoopRenderBenchmarks.cs
File metadata and controls
74 lines (65 loc) · 2.09 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
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Heddle.Performance.Runners;
namespace Heddle.Performance;
/// <summary>
/// Phase 5 large-loop render head-to-head (spec D5/WI9), run with
/// <c>dotnet run -c Release -- --filter *LoopRenderBenchmarks*</c>. A single list iteration over
/// 5,000 rows, each emitting two scalar members — output dominated by one large loop. All five
/// engines render raw over models materialized once (no per-op model allocation) and are
/// parity-checked byte-identical in <see cref="Setup"/> before any timing. Host-free (no Razor/DI).
/// </summary>
[MemoryDiagnoser]
public class LoopRenderBenchmarks
{
private LoopHeddleTest _heddleTest;
private LoopFluidTest _fluidTest;
#if !NET6_0
private LoopScribanTest _scribanTest;
#endif
private LoopDotLiquidTest _dotLiquidTest;
private LoopHandlebarsTest _handlebarsTest;
[GlobalSetup]
public void Setup()
{
_heddleTest = new LoopHeddleTest();
_fluidTest = new LoopFluidTest();
#if !NET6_0
_scribanTest = new LoopScribanTest();
#endif
_dotLiquidTest = new LoopDotLiquidTest();
_handlebarsTest = new LoopHandlebarsTest();
// 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.AssertLoop();
}
// 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();
}
}