Repository navigation
Run benchmarks in offline mode - #18487
Merged
Merged
Conversation
Currently, we have the simulated benchmarks on codspeed turned of, they flake to much (https://codspeed.io/astral-sh/uv/benchmarks/crates/uv-bench/benches/uv.rs::uv::resolve_warm_airflow::resolve_warm_airflow?runnerMode=Simulation&period=1m), while the walltime benchmarks are kinda stable. Looking into two of these spurious regressions, we see that they occur in the network code, and that the CI runs for them took >10min, while regularly runs take <10min. * https://codspeed.io/astral-sh/uv/runs/compare/699738846a7b43e19b4d2e67..699778f1f92bec70ac9b3024?uri=crates%2Fuv-bench%2Fbenches%2Fuv.rs%3A%3Auv%3A%3Aresolve_warm_airflow%3A%3Aresolve_warm_airflow&runnerMode=Simulation * https://github.com/astral-sh/uv/actions/runs/22199337000/job/64207958534 * https://codspeed.io/astral-sh/uv/runs/compare/699caa16bfa44e7f9c0b44c5..699cc8e475e640df09b7f01f?uri=crates%2Fuv-bench%2Fbenches%2Fuv.rs%3A%3Auv%3A%3Aresolve_warm_airflow%3A%3Aresolve_warm_airflow&runnerMode=Simulation * https://github.com/astral-sh/uv/actions/runs/22325481213/job/64594783994 uv caches PyPI responses for 10min, after that, it has to make revalidation request. If the build takes >7min, and we prime the caches before the build, the most likely explanation is that these runs have to make revalidation requests. This is not a problem for walltime benchmarks, which run multiple times, where revalidation requests in one run are just an outlier that gets ignored overall. The fix is that the benchmark itself primes the cache, and then runs in offline mode. We keep the cache priming in the GitHub action before the benchmark builds for the sake of the job logs, while we need the priming inside the bench for running `cargo bench` locally without extra setup. Running the benches themselves with an offline client make uv ignore the 10min threshold.
konstin
force-pushed
the
konsti/simulated-benchmarks-offline-mode
branch
from
March 15, 2026 17:51
99c5b30 to
7964a9d
Compare
charliermarsh
approved these changes
Mar 16, 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.
Currently, we have the simulated benchmarks on codspeed turned of, they flake to much (https://codspeed.io/astral-sh/uv/benchmarks/crates/uv-bench/benches/uv.rs::uv::resolve_warm_airflow::resolve_warm_airflow?runnerMode=Simulation&period=1m), while the walltime benchmarks are kinda stable.
Looking into two of these spurious regressions, we see that they occur in the network code, and that the CI runs for them took >10min, while regularly runs take <10min.
uv caches PyPI responses for 10min, after that, it has to make revalidation request. If the build takes >7min, and we prime the caches before the build, the most likely explanation is that these runs have to make revalidation requests. This is not a problem for walltime benchmarks, which run multiple times, where revalidation requests in one run are just an outlier that gets ignored overall.
The fix is that the benchmark itself primes the cache, and then runs in offline mode. We keep the cache priming in the GitHub action before the benchmark builds for the sake of the job logs, while we need the priming inside the bench for running
cargo benchlocally without extra setup. Running the benches themselves with an offline client make uv ignore the 10min threshold.