Skip to content

Commit

Permalink
Pin benchmark requirements (#4429)
Browse files Browse the repository at this point in the history
## Summary

This should make benchmarks more consistent.
  • Loading branch information
ibraheemdev authored Jun 20, 2024
1 parent e783a79 commit e797d3e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ uv-resolver = { workspace = true }
uv-types = { workspace = true }

anyhow = { workspace = true }
chrono = { workspace = true }
codspeed-criterion-compat = { version = "2.6.0", default-features = false, optional = true }
criterion = { version = "0.5.1", default-features = false, features = ["async_tokio"] }
once_cell = { workspace = true }
Expand Down
21 changes: 17 additions & 4 deletions crates/bench/benches/uv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn resolve_warm_jupyter(c: &mut Criterion<WallTime>) {
let venv = PythonEnvironment::from_root("../../.venv", cache).unwrap();
let client = &RegistryClientBuilder::new(cache.clone()).build();
let manifest = &Manifest::simple(vec![Requirement::from(
pep508_rs::Requirement::from_str("jupyter").unwrap(),
pep508_rs::Requirement::from_str("jupyter==1.0.0").unwrap(),
)]);

let run = || {
Expand Down Expand Up @@ -47,7 +47,7 @@ fn resolve_warm_airflow(c: &mut Criterion<WallTime>) {
let venv = PythonEnvironment::from_root("../../.venv", cache).unwrap();
let client = &RegistryClientBuilder::new(cache.clone()).build();
let manifest = &Manifest::simple(vec![
Requirement::from(pep508_rs::Requirement::from_str("apache-airflow[all]").unwrap()),
Requirement::from(pep508_rs::Requirement::from_str("apache-airflow[all]==2.9.2").unwrap()),
Requirement::from(
pep508_rs::Requirement::from_str("apache-airflow-providers-apache-beam>3.0.0").unwrap(),
),
Expand All @@ -72,6 +72,7 @@ criterion_main!(uv);

mod resolver {
use anyhow::Result;
use chrono::NaiveDate;
use once_cell::sync::Lazy;

use distribution_types::IndexLocations;
Expand All @@ -87,7 +88,8 @@ mod resolver {
use uv_distribution::DistributionDatabase;
use uv_git::GitResolver;
use uv_resolver::{
FlatIndex, InMemoryIndex, Manifest, Options, PythonRequirement, ResolutionGraph, Resolver,
FlatIndex, InMemoryIndex, Manifest, OptionsBuilder, PythonRequirement, ResolutionGraph,
Resolver,
};
use uv_toolchain::PythonEnvironment;
use uv_types::{BuildIsolation, EmptyInstalledPackages, HashStrategy, InFlight};
Expand Down Expand Up @@ -157,9 +159,20 @@ mod resolver {
PreviewMode::Disabled,
);

let options = OptionsBuilder::new()
.exclude_newer(Some(
NaiveDate::from_ymd_opt(2024, 6, 20)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc()
.into(),
))
.build();

let resolver = Resolver::new(
manifest,
Options::default(),
options,
&python_requirement,
Some(&MARKERS),
Some(&TAGS),
Expand Down

0 comments on commit e797d3e

Please sign in to comment.