Comments (2)
I have the same problem, except it does not complete in reasonable time, the code:
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use rand::prelude::*;
pub fn lookup(c: &mut Criterion) {
let mut group = c.benchmark_group("lookup");
for size in (0..4*1024*1024).step_by(1024*1024) {
let mut rng = thread_rng();
let mut data: Vec<u64> = vec![0; size];
rng.fill(&mut data[..]);
let mut keys = data.clone();
keys.shuffle(&mut rng);
group.bench_with_input(BenchmarkId::new("linear", size), &size, |b, size| {
b.iter(|| {
for key in &keys {
black_box(data.contains(key));
}
});
});
let mut rng = thread_rng();
let mut data: Vec<u64> = vec![0; size];
rng.fill(&mut data[..]);
let mut keys = data.clone();
keys.shuffle(&mut rng);
group.bench_with_input(BenchmarkId::new("constant", size), &size, |b, size| {
b.iter(|| {
for key in &keys {
black_box(data.contains(key));
}
});
});
}
group.finish();
}
criterion_group!(benches, lookup);
criterion_main!(benches);
I tried to reduce number of samples and confidence level like this: group.confidence_level(0.6).sample_size(12);
but it didn't really help.
from criterion.rs.
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 15150.2s, or reduce sample count to 10.
Benchmarking lookup/linear/1048576: Collecting 100 samples in estimated 15150 s (100 iterations)
from criterion.rs.
Related Issues (20)
- Where are baselines saved / is there a command to list saved baselines ? HOT 2
- Configuration via env variables
- Huge variance between successive bench runs without code changes. HOT 1
- Bench with huge input
- Unstable feature crate attribute not recognized in different modules
- Sample size scaling for running in CI HOT 1
- how to call async functions during setup process? HOT 1
- incorrect doc for iter_batched_ref
- profiling with iter_batched_ref
- AsyncBencher::iter_batched and iter_batched_ref should allow for async setup HOT 1
- [Question] Any idea to support multi threaded routine call for throughput test? HOT 1
- --profile-time doesn't work HOT 1
- panic in drop
- Custom Iter with async setup and non-async benched value
- "cargo bench -- <filter>" does not actually filter the benchmarks
- Can't call a function for the benchmark from the crate inside a Rust workspace HOT 1
- Quickstart instructions still use criterion 0.4 HOT 1
- Benchmarking With One function result as Input
- Help needed? HOT 5
- Found argument '--bench' which wasn't expected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from criterion.rs.