test: deterministic perf invariants for the datatree cache#124
Open
lhoupert wants to merge 1 commit into
Open
Conversation
Wall-clock benchmarks are too noisy to catch "1 HEAD became 30". Pin the perf invariants of the version-aware cache by counting side effects with spies: - no HEAD storm: N opens within version_probe_ttl => one obstore.head; re-probes after the window elapses (monkeypatched clock). - store built once: N opens => _get_store's constructor runs once (no per-request Boto3CredentialProvider/S3Store rebuild). - no redundant reopen: a stable token => one open; a changed token => exactly one more. - bounded memo: _open_dataset_cached is an lru_cache with a positive maxsize (regression guard vs the prior unbounded @cache). Also adds a warm-open benchmark (test_open_cached) so the CI github-action -benchmark job alerts if the probe throttle/memo regress on the hot path. These were split out of #119 as the "optional hardening" the reviewer asked to separate; the runtime fix they guard is in the cache PR. Refs #118 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The "optional hardening" split out of #119 per review: extra test/CI rigor for the version-aware cache (#122). No runtime code.
Wall-clock benchmarks are too noisy to catch "1 HEAD became 30". These pin the cache's perf invariants by counting side effects with spies:
version_probe_ttl→ oneobstore.head; re-probes after the window (monkeypatched clock)._get_store's constructor runs once._open_dataset_cachedis anlru_cachewith positive maxsize.Also adds a warm-open benchmark (
test_open_cached) so the CI github-action-benchmark job alerts if the probe throttle/memo regress.uv run pytest→ 107 passed; benchmarks collect; pre-commit clean.Refs #118. Stacked on #122 — this PR targets the
fix/issue-118-stale-cachebranch; retarget tomain(gh pr edit <num> --base main) once #122 merges.🤖 Generated with Claude Code