Verify Optimization
verify_optimizationProve an optimization is both correct and significantly faster: runs candidate against original for output equality, then times both to confirm a minimum speedup passes statistical significance.
Instructions
PROVE an optimisation: same outputs, measurably AND SIGNIFICANTLY faster.
Two gates, in order. Correctness: runs candidate against original on
shared inputs — a faster-but-wrong candidate fails here and is never
timed. Speed: times both at increasing sizes; accepts only when the
median ratio clears min_speedup AND a one-sided Mann-Whitney U test
rejects "not faster" at every counted size (2-3), or a
Bonferroni-corrected majority above that — one size never accepts alone.
See inference for the per-size U statistic, p-value, effect size.
A rejection names which gate failed and by how much, e.g. "correct, 1.3x median, but only 1/4 sizes significant."
Accepted grades cross_checked; any rejection — wrong, not faster
enough, not significant — grades ungraded: correctness alone earns no
grade for the speed claim this tool answers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sizes | No | Input sizes to time both programs at (2-3+ sizes needed for significance); omit for defaults | |
| language | Yes | Language both `original` and `candidate` are written in | |
| original | Yes | Baseline program to compare against | |
| candidate | Yes | Optimised version of `original`, to prove correct and measurably faster | |
| min_speedup | No | Minimum median speedup ratio required to accept the optimisation; default 1.15 (15% faster) | |
| test_inputs | No | Inputs to confirm both programs still agree on; omit to use the default set |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||