mybench
Simple (and very primitive) benchmarking macro.
Use cases:
-
bench!(wrapper, "Prompt")
calculates average execution time for code insidewrapper
function for 10,000 times. -
bench!(wrapper, number_of_repetitions, "Prompt")
calculates average execution time for code insidewrapper
function fornumber_of_repetitions
times.
Result is displayed as filename:row:col 'Prompt' xxx.yy ms
Examples
Output:
If you don't see stdout, try this: cargo test -- --show-output
If you see:
Don't worry, this is an intermediate result (the test is not yet completed). Wait a little longer and let the test end.