Indexing unit benchmarks
Summary
Add a unit benchmark for each extractor in the indexer, the goal is:
- during the development phase, seeing fastly and efficiently the impact of local optimization
- during the performance-regression investigation phase, helping to find local regressions
Checklist
- extractors
- prefix db
I started looking into this issue and it’s not as easy as I thought;
- criterion does not support it
- bencher does not support it
-
microbench do not use the
#[bench]attribute and thus will run everytime we run our tests -
It’s still nightly in the stdlib and we can’t do a
#[cfg(nightly)]but it may be possible to make something ok-ish with select-rustc
I implemented a first version of a unit benchmark using the nightly stdlib solution since it’s the only one that allows unit benchmarks.
You can look at this commit; https://github.com/meilisearch/milli/pull/581/commits/10b42cc0d79f7eb975701a19e3d918e6f400ed3f
Basically, we need to import select-rustc; once this is done, we can #[cfg(feature = "nightly")], and we need to do this for everything related to the benchmarks.
To simplify the code a little bit, I created a module in the test module where I threw my benchmarks.