perf(runner): cache data-provider lookup per file#767
Merged
Conversation
Scan each test file's @data_provider annotations once into a memoized fn->provider map and replace the per-test grep+sed probe with a pure-bash lookup. Also short-circuit the provider-data capture fork for the common no-provider case, in both the run path and the test-counting path. No behaviour change. Closes #763.
JesusValeraDev
approved these changes
Jul 11, 2026
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.
🤔 Background
Related #763
Every test paid a
grep -B2 | sedfork just to check whether it had a@data_providerannotation, re-reading the file from disk once per test. The scan is identical for every function in a file, so it only needs to happen once.💡 Changes
fn -> providermap; per-test lookups are now pure-bash (no fork). Same single scan removes the per-test capture fork in both the run path and the test-counting path.grep202 -> 2,sed300 -> 100,awk~1 per file (memoization confirmed, not per-test); ~14% faster wall-clock (load-variable). Win is platform-independent, unlike the clock work.--parallel. A dropped total would have signalled missed detection.get_provider_dataretained as a public wrapper over the new map.shfmtdrift (v3.13.1 vs the version the tree was formatted with) was left untouched; the added code shows no drift and there is no shfmt CI gate.