Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 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/uv-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ flate2 = { workspace = true }
fs-err = { workspace = true }
futures = { workspace = true }
jiff = { workspace = true }
sha2 = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true }
tokio-util = { workspace = true }
Expand Down
11 changes: 11 additions & 0 deletions crates/uv-bench/benches/uv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use criterion::{BatchSize, Criterion, criterion_group, criterion_main, measureme
use flate2::write::GzEncoder;
use futures::executor::block_on;
use futures::io::AllowStdIo;
use sha2::{Digest, Sha256};
use tokio_util::compat::{FuturesAsyncReadCompatExt, FuturesAsyncWriteCompatExt};
use uv_cache::Cache;
use uv_client::{BaseClientBuilder, Connectivity, RegistryClientBuilder};
Expand All @@ -29,6 +30,15 @@ const MANY_FILES_WHEEL_FILENAME: &str = "manyfiles-0.0.0-py3-none-any.whl";
const MANY_FILES_WHEEL_FILE_COUNT: usize = 10_000;
const MANY_FILES_SDIST_TOP_LEVEL: &str = "manyfiles-0.0.0";
const MANY_FILES_SDIST_FILE_COUNT: usize = 10_000;
const SHA256_BENCHMARK_SIZE: usize = 1024 * 1024;

fn hash_sha256(c: &mut Criterion<WallTime>) {
let bytes = vec![0_u8; SHA256_BENCHMARK_SIZE];

c.bench_function("hash_sha256", |b| {
b.iter(|| black_box(Sha256::digest(black_box(&bytes))));
});
}

fn create_many_files_wheel() -> tempfile::NamedTempFile {
let archive = tempfile::NamedTempFile::new().expect("Failed to create temporary archive");
Expand Down Expand Up @@ -330,6 +340,7 @@ criterion_group! {
name = uv;
config = criterion_with_preview();
targets =
hash_sha256,
unpack_sdist_many_files,
unzip_wheel_many_files,
prepare_wheel_many_files,
Expand Down
3 changes: 3 additions & 0 deletions crates/uv-extract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ tokio = { workspace = true }
tokio-util = { workspace = true, features = ["compat"] }
tracing = { workspace = true }

[target.'cfg(all(target_arch = "aarch64", not(target_os = "windows")))'.dependencies]
sha2 = { workspace = true, features = ["asm"] }

[features]
default = []

Expand Down
Loading