Repository navigation
Test framework, stage 4: the benchmarks in Catch2 - #478
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
TM25 moves the six benchmark executables into Catch2 (TMD16). This is the harness for it. - al_add_test_binary takes BENCH_SOURCES: benchmark files built into the binary beside its tests. Their cases are tagged [!benchmark], which Catch2 hides, so no test file's entry, the combined run or a per-case entry runs them. - Each benchmark file is an entry of its own, bench/<binary>/<stem>, running "[#<stem>][!benchmark]" with the console reporter and an XML one, Testing/benchmarks/<binary>_<stem>.xml (Catch2's JSON reporter drops benchmarks). It is labelled benchmark and manual, as the old executables were, so BUILD_AND_RUN_BENCHMARKS runs it and the default run does not. It runs alone, since anything beside it would move its numbers. - altestbenchmark.h gives a benchmark file Catch2's macros and ll_test::skipUnlessOptimised(), every benchmark case's first line: the code compiles in every configuration and runs only where the numbers mean something, as the old executables exited 125 elsewhere. - test_support_tests checks the filters from outside: a benchmark file's cases are hidden from the filter its tests' entries run, and its benchmark entry's filter runs them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BENCH_alscript becomes alscript_bench.cpp in alscript_tests: seven cases, one a section of the old table, and 85 benchmarks, one an old timed cell, each named for its row and column. The two typing cases choose their solver as the old loop did, not by the binary's rerun. - The lines that said what is right, such as "errors found (0 is right)" and "the questions below answer (3 is right)", are checks. - The script's bytes and the problems found are printed, as before. - The volatile sink and its checksum go: each body returns what it made. Checked against four runs of the old executable on this Mac: in a run of the new, every benchmark's mean agrees with the old median, inside its 95% interval or the old runs' own spread. Two of the new solver's rows over a fragment moved between two runs of the new, as the new solver's rows do in the old table. The run takes six minutes, at Catch2's 100 samples, where the old took 37 seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BENCH_alregex becomes alregex_bench.cpp in llcommon_tests: seven cases, one a section of the old table, and 25 benchmarks for its 34 cells. A Boost number the old table printed beside several RE2 variants is measured once, and the speedup column, which was worked out, goes. Each benchmark is named for what it runs and what a call covers: ten lines of chat, 770 places in a script, 10,000 log lines. Checked against four runs of the old executable on this Mac: every benchmark's mean agrees with the old median, once the old helper's clock read is taken off, about 15 ns a pass, which a pass of one line or row carried. The run takes 23 seconds, where the old took 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BENCH_llsimd becomes llsimd_bench.cpp in llmath_tests: seven cases, one a section of the old table, and 81 benchmarks on NEON, one an old cell; x86 builds add the rows they always had. A call is a whole pass, named for how many elements it covers, where the old number was per element. The processor and ISA line is printed once a run. - The arrays are made once a run, where each row made its own, and each call runs over views of them it holds as locals. Run over the arrays in a static, a kernel reloaded their bounds for every element, since any store it made might have moved them, and the cached rows were 40% slower for it. The kernel is copied into the call for the same reason: the transforms' matrix is a local too. - The morph rows add their weight and take it away in turn, where the old ones added it on every pass without end. Checked against four runs of the old executable on this Mac. Most rows agree with the old median. The memcpy rows up to 1 KB came out at a fifth to a half of the old: the old helper read the clock after every pass, about 15 ns, and a pass was one copy. The large copies and a few kernels move by 5 to 15% either way between runs, the batch kernels' faster in every run, each with its output still feeding the checksum it returns. The run takes 76 seconds, where the old took 12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BENCH_altextdiff, BENCH_altextengine and BENCH_altextdraw become benchmark files: the first two in llui_tests, over the headless UI the binary makes, and the drawing in llui_gl_tests, on its shared context. Each case makes the editors it measures and lets them go, closing the find's worker and putting focus back, so the state guard finds the process as it was. - altextdiff: four cases and 48 benchmarks, one an old cell. The keystroke rows type a character and take it away in turn, a call a keystroke, as the old number was per keystroke. What each comparison says of some edits is printed, as before. - altextengine: eighteen cases and 108 benchmarks. A case starts from editors of its own where the old rows ran one after another over the same two. Rows that put the text back over several steps take a step a call. The history rows break the typing run before each character they type, so a sample's undos take back exactly what it typed. - altextdraw: three cases and 12 benchmarks, a frame each, the draw and the flush on the clock and the GPU waited for off it. The draw calls a frame makes are printed. Checked against four runs of the old executables on this Mac. All of altextdiff's and altextdraw's agree with the old medians but altextdraw's first frame, which the old run measured while its caches filled: it came out slower than the same frame with squiggles on. altextengine's agree but where the old rows ran over what earlier rows left: - An edit with every match lit, or a squiggle on every other line, cost 125 us an edit in the old run and 2 us here. The old rows came after Replace All undone, which left 20,000 lines dirty in the highlighter, and every edit walks that list until idle time lexes them, which a bench never gives. Fresh editors measure the layers. - The history's notation and LLSD rows typed their character into one run that grew on every pass; here each is a step of its own. - Two vim rows, which in the old run followed all of the above, are 7% and 36% faster. The three take 3.8 minutes, where the old took 50 seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every benchmark is a file of a test binary now, so the function that built one into an executable of its own has nothing left to build. BUILD_BENCHMARKS builds the binaries with benchmark files, and BUILD_AND_RUN_BENCHMARKS runs ctest -L benchmark as it did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67e4e77 to
64ed06d
Compare
Description
Stage 4 of the test framework's move from TUT to Catch2 (TM25): the six hand-rolled benchmark executables become Catch2 benchmark files, each built into the test binary whose link set it matches. Six executables go.
alscript_benchalscript_testsalregex_benchllcommon_testsllsimd_benchllmath_testsaltextdiff_bench,altextengine_benchllui_testsaltextdraw_benchllui_gl_testsIt stacks on #475 (
rye/tm24-test-fixes).The harness (f400470)
BENCH_SOURCES:al_add_test_binarybuilds benchmark files into the binary beside its tests. Their cases are tagged[!benchmark], which Catch2 hides, so the test files' entries, the combined run and per-case entries all leave them out.bench/<binary>/<stem>, labelledbenchmarkandmanualas the old executables were. It runs alone and reports to the console and toTesting/benchmarks/<binary>_<stem>.xml; Catch2's JSON reporter drops benchmarks.BUILD_AND_RUN_BENCHMARKSstill runsctest -L benchmark -V.ll_test::skipUnlessOptimised()(test/altestbenchmark.h). The code now compiles in every configuration, and the entry reads as skipped outside an optimised build, as the old exit 125 did.The conversions (509176f..fc5bdf2), by hand
BENCHMARK, named for its row and column. A case is a section of the old table.CHECKs. Counts that are neither times nor right or wrong are printed, as before.volatilesinks go; each body returns what it made.al_add_benchgoes (853378b).Related Issues
Issue Link: none. This follows #471, #472, #474 and #475.
Checklist
Additional Notes
ctest -LE manualpass, and so do all 19 pending combined runs;manuallabel.llimagej2ckdu_testis still TUT, and must be converted before TUT goes (TM26).🤖 Generated with Claude Code