Skip to content

Commit 3a2af5b

Browse files
committed
test: record repeated performance evidence and compatibility validation
Keep semantic regression oracles from the rejected conditional-branch experiment; do not retain its inconsistent production optimization. Record 144 benchmark measurements, identical benchmark IL for kept changes, all target/native checks, and unchanged imported outcomes: 34945 pass, 152 existing failures, 36 skips, no new failures or observed crashes.
1 parent 37d445a commit 3a2af5b

11 files changed

Lines changed: 221 additions & 0 deletions

File tree

‎test/FastExpressionCompiler.Performance/Measure.ps1‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,13 @@ try {
2929
$env:FEC_PERF_OUTPUT = "$run/results"
3030
dotnet "$run/binaries/FastExpressionCompiler.Performance.dll" --filter $Filter *> "$run/run.log"
3131
if ($LASTEXITCODE) { throw "Benchmark host failed; see $run/run.log" }
32+
$exports = @(Get-ChildItem "$run/results/results/*-report-full.json" -ErrorAction SilentlyContinue)
33+
if ($exports.Count -eq 0) { throw "No benchmark results; see $run/run.log" }
34+
foreach ($export in $exports) {
35+
$benchmarks = (Get-Content -LiteralPath $export.FullName -Raw | ConvertFrom-Json).Benchmarks
36+
foreach ($benchmark in $benchmarks) {
37+
if ($null -eq $benchmark.Statistics) { throw "Benchmark failed: $($benchmark.FullName)" }
38+
}
39+
}
3240
} finally { $env:FEC_PERF_OUTPUT = $oldOutput }
3341
} finally { Pop-Location }
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
phase,method,workload,mean_ns,standard_error_ns,confidence999_halfwidth_ns,samples,allocated_bytes
2+
Compilation,SystemCompile,Array,44092.36429663609,407.32815266319074,2427.1935824096317,7,5111
3+
Compilation,FastCompile,Array,2621.0309961963353,19.430183989718255,133.4625652749972,6,1151
4+
Compilation,LightCompile,Array,2424.5386448831327,27.224825466302182,147.2286576927394,8,1151
5+
Construction,SystemTree,Array,969.3136211490965,5.787494632720198,34.48661659874039,7,1192
6+
Construction,LightTree,Array,402.8292236121681,1.8216322897360446,9.85117341374887,8,672
7+
Invocation,SystemInvoke,Array,1.054202266541688,0.0017252807453472041,0.009330115581273508,8,0
8+
Invocation,FastInvoke,Array,1.3237841197142184,0.0016429300083295327,0.008884772470217512,8,0
9+
Invocation,LightInvoke,Array,1.3212930901631867,0.0038169751589302897,0.020641753233328133,8,0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
phase,method,workload,mean_ns,standard_error_ns,confidence999_halfwidth_ns,samples,allocated_bytes
2+
Compilation,SystemCompile,Array,58547.57658837992,1923.9837321399457,10404.677989809199,8,5111
3+
Compilation,FastCompile,Array,3416.32220589223,81.83097329810235,487.61572686020907,7,1152
4+
Compilation,LightCompile,Array,2963.829124362262,43.158118028056904,257.1712915537042,7,1151
5+
Construction,SystemTree,Array,1208.9290449575717,37.76366866130416,204.2214835661297,8,1192
6+
Construction,LightTree,Array,527.3626725838265,28.377524943103573,153.46232104175343,8,672
7+
Invocation,SystemInvoke,Array,1.0453298149441264,0.0032650202882277927,0.017656846137373266,8,0
8+
Invocation,FastInvoke,Array,1.2981700574302244,0.002646519738569882,0.014312067827552054,8,0
9+
Invocation,LightInvoke,Array,1.2998468951871944,0.002365871755547004,0.014097794872077418,7,0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
phase,method,workload,mean_ns,standard_error_ns,confidence999_halfwidth_ns,samples,allocated_bytes
2+
Compilation,SystemCompile,Conditional,27237.520292207795,838.8639100267337,4998.63583113423,7,4749
3+
Compilation,FastCompile,Conditional,2293.181434552196,10.619921840017621,72.94640197636504,6,1136
4+
Compilation,LightCompile,Conditional,2474.948375176611,65.05998891362111,351.83677666228107,8,1135
5+
Construction,SystemTree,Conditional,682.0495613296781,29.50878834748411,159.58006062946978,8,712
6+
Construction,LightTree,Conditional,109.25339300498254,2.1186179819405773,11.457237146695228,8,408
7+
Invocation,SystemInvoke,Conditional,1.3325786860725501,0.025716880262671934,0.1390738671880405,8,0
8+
Invocation,FastInvoke,Conditional,1.1029724193602846,0.0019814990040205754,0.01180738830514044,7,0
9+
Invocation,LightInvoke,Conditional,1.456330592293892,0.05360008240937755,0.31939303775116945,7,0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
phase,method,workload,mean_ns,standard_error_ns,confidence999_halfwidth_ns,samples,allocated_bytes
2+
Compilation,SystemCompile,Conditional,28920.111283847604,1171.0280526619538,6332.782133988809,8,4751
3+
Compilation,FastCompile,Conditional,2943.1422084725396,75.2368800483712,406.87220831670874,8,1128
4+
Compilation,LightCompile,Conditional,2036.0785071992375,28.612096703005292,170.49422447910754,7,1136
5+
Construction,SystemTree,Conditional,526.4769093096265,3.654186148155998,21.7746235062429,7,712
6+
Construction,LightTree,Conditional,100.78099814368055,0.9431908560070429,5.62030092376333,7,408
7+
Invocation,SystemInvoke,Conditional,0.9108637075684305,0.0007482628613593188,0.0040465176467566226,8,0
8+
Invocation,FastInvoke,Conditional,1.0925913443853665,0.0009054578315352813,0.005395456767414297,7,0
9+
Invocation,LightInvoke,Conditional,1.0907725181655428,0.0009683142706522157,0.005236529816116151,8,0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
phase,method,workload,mean_ns,standard_error_ns,confidence999_halfwidth_ns,samples,allocated_bytes
2+
Compilation,SystemCompile,Conditional,19747.49481397216,191.31221794749212,1034.5939989034505,8,4751
3+
Compilation,FastCompile,Conditional,1937.3223442287428,14.271873351622522,85.04346969767312,7,1127
4+
Compilation,LightCompile,Conditional,2001.8317771236075,34.058675729801735,184.18531706282687,8,1135
5+
Construction,SystemTree,Conditional,618.4042653827383,40.90746225400293,243.76004753514005,7,712
6+
Construction,LightTree,Conditional,89.71923810780875,0.2865719376669982,1.5497473718368786,8,408
7+
Invocation,SystemInvoke,Conditional,1.2011257647880265,0.0017795024866120118,0.009623340387950844,8,0
8+
Invocation,FastInvoke,Conditional,1.0959969554896767,0.004571584488996063,0.024722591837252943,8,0
9+
Invocation,LightInvoke,Conditional,1.0740817028453802,0.0008019874305278588,0.0043370538051461524,8,0

‎test/FastExpressionCompiler.Performance/Measurements/README.md‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ arguments, covariance, ignored reads and exception-region receivers.
3636

3737
Code commit: `7b6863bc`. Both libraries build across all four targets with zero warnings/errors.
3838

39+
Focused frozen-binary repeat: `00-array-repeat.csv` versus `01-vector-array-repeat.csv`.
40+
System compilation moved 44,092 -> 58,548 ns, standard FEC 2,621 -> 3,416 ns, Light
41+
2,425 -> 2,964 ns. Absolute times worsened with the host conditions. Relative to System,
42+
standard FEC improved about 1.8% and Light about 8.0%, in the same direction as the first
43+
run. The small standard-FEC difference remains uncertain; do not advertise the first
44+
run's absolute percentages as an established universal gain.
45+
3946
## Optimization 2: named-field lookup without enumerating every field
4047

4148
Use TypeInfo.GetDeclaredField and recurse to the base type only when necessary. This
@@ -56,3 +63,51 @@ One initial native run failed the existing generated FlatExpression roundtrip pr
5663
test (reported case seed 864021005, replay seed 6H3IIevvWaa1). Replays with both baseline
5764
and current libraries passed, including the explicit reported seed and default settings;
5865
the failure remains unreproduced. Preserve the failing log rather than masking it.
66+
67+
Code commit: `a9b98445`. Comparing the original baseline directly with this final production
68+
code gives Light construction improvements of 40.7%, 52.7%, 35.7% and 55.6%, respectively.
69+
The more useful per-change comparison above uses its immediate parent as requested.
70+
71+
## Rejected runtime candidate: direct conditional comparison branches
72+
73+
Baseline benchmark commit: `37d445aa`; production baseline remains `a9b98445`.
74+
Candidate: replace equality/inequality materialization followed by Brfalse with Bne_Un/Beq
75+
for simple non-lifted, non-overloaded operands. Keep complex/EH cases on the existing path.
76+
The candidate passes the six standard/Light regression methods, including primitive and
77+
reference input matrices, NaN, nullable and overloaded exclusions, side effects and EH.
78+
79+
Evidence: `03-conditional-before.csv` / `03-conditional-rejected.csv` and their repeat files.
80+
Standard compilation: 2,642 -> 1,937 ns initially, but 2,293 -> 2,943 ns on repeat.
81+
Light compilation: 2,314 -> 2,002 ns initially, 2,475 -> 2,036 ns on repeat. System controls
82+
also moved considerably. Standard invocation was 1.196 -> 1.096 ns initially and
83+
1.103 -> 1.093 ns on repeat; these tiny loop-inclusive timings do not establish a runtime win.
84+
Construction was measured in both runs as well. The inconsistent compilation results
85+
do not justify retaining this production change. It is removed from the branch.
86+
Retain the added workload and regression oracles for future investigations. The candidate
87+
patch and its exact frozen binaries/hashes remain in the local measurement archive.
88+
89+
## Final validation and runtime interpretation
90+
91+
The two kept changes emit exactly the same IL as the original baseline for all five
92+
benchmark workloads, in both standard and Light modes (ten delegate bodies compared).
93+
No delegate runtime speedup is claimed. Original/final timings for the first four
94+
workloads are in `00-baseline.csv` and `02-named-field.csv`; the conditional workload's
95+
final production timing is `03-conditional-before.csv`. Candidate timing files are not
96+
final production results. No compiler layout changes or System fallbacks were introduced.
97+
98+
All library targets (`net472`, `netstandard2.1`, `net8.0`, `net10.0`) build with zero warnings
99+
and errors. Native .NET 10 and .NET 8 suites pass (1,712 / 1,711 legacy tests plus registered
100+
regressions). Framework passes 712 TestX executions and 1,595 legacy tests, using the
101+
existing external en-US runner. One initial unreproduced property-test failure is recorded above.
102+
103+
The full imported compatibility suite was rerun against frozen final compiler binaries:
104+
34,945 pass, 152 fail, 36 normalized skips, zero observed crashes/timeouts. All outcome
105+
groups match the fixes baseline exactly: zero newly failing or unmatched groups. The
106+
152 pre-existing failures remain open. Skips include two compilation-mode cases of the
107+
one known deep-tree crash, which remains deferred; its explicit Skip discovery was
108+
verified without executing the tree body. See `validation.json` for counts and hashes.
109+
110+
144 benchmark measurements were collected across nine serial runs. Each kept optimization
111+
has a separate code commit with measurements of construction, compilation and runtime.
112+
These local commits and evidence are ready for a later stacked performance PR; nothing
113+
has been pushed and the previous pull requests are unchanged.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"baselineCompilerCommit": "3f682768d6b23e445ae46595e456658899e371e4",
3+
"finalProductionCommit": "a9b98445",
4+
"completedBatches": 21,
5+
"actualBatchOutcomes": {
6+
"Passed": 34945,
7+
"Failed": 152,
8+
"NotExecuted": 34
9+
},
10+
"knownDeferredDeepTreeCases": 2,
11+
"normalizedBaselineCases": 35133,
12+
"normalizedOutcomes": {
13+
"Passed": 34945,
14+
"Failed": 152,
15+
"Skipped": 36
16+
},
17+
"observedCrashes": [],
18+
"changedOutcomeGroups": [],
19+
"unmatchedCurrentGroups": 0,
20+
"unmatchedBaselineGroups": 0,
21+
"nativeValidation": {
22+
"standard-targets": 0,
23+
"light-targets": 0,
24+
"native-net10": 0,
25+
"native-net8": 0,
26+
"framework-build": 0,
27+
"framework-run": 0
28+
},
29+
"importedAssemblySHA256": "974d9a6f614cc796bc942ff5951e2f8d548286153927b01d7a5732356342e26a",
30+
"compilerAssemblySHA256": "61ef1449552e6e18c32fc1ea3e21c1bbe4b1b5308636706e5c698be44cad3bb7"
31+
}

‎test/FastExpressionCompiler.TestsRunner.Net472/Program.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static void RunLightExpressionTests(object state)
3636
var t = (LightExpression.TestRun)state;
3737
t.Run(new LightExpression.UnitTests.NumericConversionRegressionTests());
3838
t.Run(new LightExpression.UnitTests.IntrinsicConstructorExceptionRegressionTests());
39+
t.Run(new LightExpression.UnitTests.ConditionalBranchRegressionTests());
3940
t.Run(new LightExpression.UnitTests.NamedFieldLookupRegressionTests());
4041
t.Run(new LightExpression.UnitTests.FormalByRefArgumentRegressionTests());
4142
t.Run(new LightExpression.UnitTests.WritableReceiverAddressRegressionTests());
@@ -131,6 +132,7 @@ static void RunLightExpressionTests(object state)
131132
var fecTests = new TestRun();
132133
fecTests.Run(new NumericConversionRegressionTests());
133134
fecTests.Run(new IntrinsicConstructorExceptionRegressionTests());
135+
fecTests.Run(new ConditionalBranchRegressionTests());
134136
fecTests.Run(new FormalByRefArgumentRegressionTests());
135137
fecTests.Run(new WritableReceiverAddressRegressionTests());
136138
fecTests.Run(new NestedMemberBindingLayoutBehaviorRegressionTests());

‎test/FastExpressionCompiler.TestsRunner/Program.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static void Main()
5454

5555
st.Run(new NumericConversionRegressionTests());
5656
st.Run(new IntrinsicConstructorExceptionRegressionTests());
57+
st.Run(new ConditionalBranchRegressionTests());
5758
st.Run(new FormalByRefArgumentRegressionTests());
5859
st.Run(new WritableReceiverAddressRegressionTests());
5960
st.Run(new NestedMemberBindingLayoutBehaviorRegressionTests());
@@ -148,6 +149,7 @@ public static void Main()
148149

149150
lt.Run(new LightExpression.UnitTests.NumericConversionRegressionTests());
150151
lt.Run(new LightExpression.UnitTests.IntrinsicConstructorExceptionRegressionTests());
152+
lt.Run(new LightExpression.UnitTests.ConditionalBranchRegressionTests());
151153
lt.Run(new LightExpression.UnitTests.NamedFieldLookupRegressionTests());
152154
lt.Run(new LightExpression.UnitTests.FormalByRefArgumentRegressionTests());
153155
lt.Run(new LightExpression.UnitTests.WritableReceiverAddressRegressionTests());

0 commit comments

Comments
 (0)