Comments (4)
You can change that value using the sample_size method on Criterion:
let mut criterion = Default::default();
criterion.sample_size(150);
criterion.bench_function(...)
Please forgive any typos, I'm writing this from my phone so I can't easily check this code.
Having said that, could you explain why you want to change that option?
from criterion.rs.
Having said that, could you explain why you want to change that option?
In my case I'm measuring writes to Redis and I'm interested in seeing how my code behaves as memory fills up, the hypothesis being that the system will get slower as the data set size increase.
Maybe I'm misunderstanding something though: what is, exactly, a "sample"? It is not the number of iterations I take it?
from criterion.rs.
Well, the most direct way to increase the number of iterations is to increase the measurement time (see here).
I'd be interested to hear how well Criterion.rs works for you in this case. For best results, the time per iteration should be roughly independent of the number of iterations. A better approach might be to create a second benchmark where you pre-populate a large database for each sample and run insertions on that. In that case, the difference between small and large iteration counts will be smaller than it would if you started with an empty database. On the other hand, there are a lot of things one might want to benchmark that won't be independent of the iteration count, so it could maybe support that use case better somehow. I'll have to think on that some more.
That's correct, a sample is not the same as an iteration. The number of iterations isn't directly controllable; Criterion.rs attempts to estimate how many iterations will result in the specified measurement time (where possible), then divides those iterations up into N samples. I'm working on some documentation to explain this all in more detail.
from criterion.rs.
then divides those iterations up into N samples. I'm working on some documentation to explain this all in more detail.
That makes sense, thank you for the explanation and +1 at more docs, I think this library has a great future, loving it. :)
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
- 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.