zkmega
zkmega copied to clipboard
Benchmark the solutions
Desc
Here we've got 3 solutions in Megcalite, besides duplicating problem in #20, we need to separate the tests for each solution, migrate the tests which are exactly we need, we don't need to test the primitives in each solution, we test the final result, for example, the result of add, mul and paring.
Benchmark
Here we can see a benchmark chapter in the rust unstable book.
Right after we completed the tests of the three basic functions, we can really do benchmarks for our wrapping work.
#![feature(test)]
extern crate test;
use test::Bencher;
#[bench]
fn bench_xor_1000_ints(b: &mut Bencher) {
b.iter(|| {
(0..1000).fold(0, |old, new| old ^ new);
});
}
The benchmark code above is what we exactly need for our library, well, feeling like pairing 1000 times?