atomic-server icon indicating copy to clipboard operation
atomic-server copied to clipboard

Benchmarks improvement: setup code for benchmark shall be separate from benchmarks itself

Open AlexMikhalev opened this issue 3 years ago • 1 comments

Proposal: create a separate setup function for benchmarks which will have db init and db.populate records before running any other benchmarks. I found a good example https://github.com/rukai/shotover-proxy/blob/6b21ba52b332f5117258673d489b13d396051c07/shotover-proxy/benches/redis_benches.rs but it needs a patched version of criterion.rs from the same author. Thoughts?

AlexMikhalev avatar Apr 25 '22 21:04 AlexMikhalev

Yeah, it's probably better to have a clean Db between each benchmark.

Also, it is probably a good idea to move some logic outside of the iter call. Currently, all random_atom and random_resource logic is executed inside the bech as well, polluting the actually interesting stuff. Basically use bench_with_input instead of bench_function and move the init logic outside of the closure, right? Not sure if I fully understand criterion though.

joepio avatar Apr 26 '22 13:04 joepio