Skip to content

Commit

Permalink
chore: fixes benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
micheleriva committed Nov 26, 2024
1 parent 0a4135f commit e226462
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ fn calc_mse(original: &Array2<f32>, quantized: &Array2<f32>) -> f32 {
.mean()
.unwrap()
}

```

See a more detailed example here: [/src/bin/example.rs](/src/bin/example.rs)
Expand Down
8 changes: 4 additions & 4 deletions benches/pq_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn bench_pq_fit(c: &mut Criterion) {

group.bench_function(format!("fit_{}x{}", n_vectors, n_dims), |b| {
b.iter(|| {
let mut pq = PQ::try_new(8, 256, Some(false)).unwrap();
let mut pq = PQ::try_new(8, 256).unwrap();
pq.fit(black_box(&data), black_box(10)).unwrap();
});
});
Expand All @@ -34,7 +34,7 @@ fn bench_pq_encode(c: &mut Criterion) {
let training_data = generate_test_data(n_vectors, n_dims);
let test_data = generate_test_data(n_vectors / 2, n_dims);

let mut pq = PQ::try_new(8, 256, Some(false)).unwrap();
let mut pq = PQ::try_new(8, 256).unwrap();
pq.fit(&training_data, 10).unwrap();

group.bench_function(format!("encode_{}x{}", n_vectors, n_dims), |b| {
Expand All @@ -55,7 +55,7 @@ fn bench_pq_decode(c: &mut Criterion) {
let training_data = generate_test_data(n_vectors, n_dims);
let test_data = generate_test_data(n_vectors / 2, n_dims);

let mut pq = PQ::try_new(8, 256, Some(false)).unwrap();
let mut pq = PQ::try_new(8, 256).unwrap();
pq.fit(&training_data, 10).unwrap();
let codes = pq.encode(&test_data).unwrap();

Expand All @@ -77,7 +77,7 @@ fn bench_pq_compress(c: &mut Criterion) {
let training_data = generate_test_data(n_vectors, n_dims);
let test_data = generate_test_data(n_vectors / 2, n_dims);

let mut pq = PQ::try_new(8, 256, Some(false)).unwrap();
let mut pq = PQ::try_new(8, 256).unwrap();
pq.fit(&training_data, 10).unwrap();

group.bench_function(format!("compress_{}x{}", n_vectors, n_dims), |b| {
Expand Down

0 comments on commit e226462

Please sign in to comment.