bench(pingora-lru): migrate benchmarks to Criterion#847
Open
C-Harshul wants to merge 5 commits intocloudflare:mainfrom
Open
bench(pingora-lru): migrate benchmarks to Criterion#847C-Harshul wants to merge 5 commits intocloudflare:mainfrom
C-Harshul wants to merge 5 commits intocloudflare:mainfrom
Conversation
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.
Closes #602
The existing benchmarks in
pingora-lruuse manualInstant::now()timing inside afn main(). This produces a single number with no warmup, no outlier handling, and no way to detect regressions automatically. This PR migrates both benchmarks to Criterion.rs.Changes
pingora-lru/Cargo.tomlAdds
criterion = { version = "0.5", features = ["html_reports"] }to[dev-dependencies].benches/bench_linked_list.rsMigrates all five operations — push, iter, search, promote, and pop — into named Criterion benchmark groups.
iter_batched(LargeInput)is used for the pop benchmark so the cost of building the list is excluded from the measured time.benches/bench_lru.rsMigrates single-thread and 8-thread concurrent benchmarks.
iter_customis used for the concurrent case since Criterion does not manage threads natively — it times the wall-clock duration of all threads completingitersoperations each, which mirrors the intent of the original benchmark.Before / after
8ns avg per operation[8.1 ns 8.3 ns 8.6 ns]