Repository navigation
lsv_measure: --only times only the listed parameter cases - #56
Merged
Merged
Conversation
A listed <name>-<index> id now narrows asv's benchmark_selection for that benchmark, so the confirmation pass no longer times every case of a parameterized function. One selection is used for the base and the patched side.
ArjunS07
merged commit Oct 9, 2026
90ceb67
into
survey/phase1-template-20261008
0 of 3 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
On bottleneck#304,
--only(from #54) took 46+ minutes for confirm sets of 71 to 96 ids, not the expected ~10 minutes. It kept whole benchmark functions and dropped unlisted ids only after timing. So a parameterized function such asTime2DReductions.time_nanargmintimed all its parameter cases in every round: about 550 cases per side per round. This change makes--onlytime only the listed parameter cases.How it works
asv's
Benchmarks.benchmark_selectionmaps each benchmark name to the parameter indices to run (Nonefor a benchmark without parameters).asv.runner.run_benchmarkskips every index not in that list and records NaN for it. This is the asv in the task images (/opt/conda/envs/asv_3.12/.../asv/runner.py, the lightspeed fork).flowchart LR A["--only ids<br/>p-3, p-7, x"] --> B["only_cases<br/>{p: {3, 7}}"] B --> C["selected.benchmark_selection<br/>p: [3, 7], x: None"] C --> D["run_benchmarks, base side"] C --> E["run_benchmarks, patched side"]<name>-<index>ids narrow that benchmark's selection to the listed indices, intersected with its current selection.<name>keeps all cases of that benchmark.selected.run()uses that one object on both sides in every round, so the base and patched sides time exactly the same cases.filter_outbuilds a new selection dict, so the full benchmark list is not changed.run()now drops non-finite times (asv's NaN for skipped cases) in the same way asNone.Changes
only_cases(only, names)inlsv_measure.py{name: set of indices}for listed<name>-<index>ids whose name LSV selected, leaving out names that are also listed plain.measure_pairedwith--onlyselected.benchmark_selectionbefore timing. A confirm set of 2 cases out of a 10-case benchmark times 2 cases per side per round.run()drops non-finite times.base_times/patched_times.Nonewas dropped. A NaN never came up because nothing was skipped.tests/docker/test_lsv_confirm_pass.pybenchmark_selectionlike asv's runner and logs every case it runs. New tests:--only {p-3, p-7}on a 10-case benchmark runs exactlyp-3, p-7on each side of each of 4 rounds (16 runs).--only, all 12 cases run.only_cases.Usage
No change: test.sh calls
lsv_measure.py --only confirm_set.json --rounds N --out lsv_measure_confirm.jsonas before.Verification
tests/docker: 450 passed, 10 skipped. Without the fix, the two new tests fail.fc-task/deshaw__versioned-hdf5__332,--network none, no timing): I built a realBenchmarkswith a 10-case benchmark, applied the selection, and calledasv.runner.run_benchmarkwith the single-case step replaced by a counter. Result: selection{'p': [3, 7], 'x': None}, ran[('p', 3), ('p', 7), ('x', 0)]. The full benchmark list still selected all 10 cases.lsv_measure.pyloads andonly_casesruns on Python 3.8.Notes
Expected time on #304, using the first pass's rate: 841 cases × 2 sides × 3 rounds in about 2670 s, so about 0.53 s per case per side. The confirm pass runs 6 rounds × 2 sides × (number of ids).
Before, about 550 cases took about 58 min at this rate; 46+ min was observed. That is about 6 to 8 times faster.