![](https://private-user-images.githubusercontent.com/854222/293600685-5277ca83-5880-407a-aafc-27435868db2d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1NDI4MDQsIm5iZiI6MTcyNDU0MjUwNCwicGF0aCI6Ii84NTQyMjIvMjkzNjAwNjg1LTUyNzdjYTgzLTU4ODAtNDA3YS1hYWZjLTI3NDM1ODY4ZGIyZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNFQyMzM1MDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yN2Q4OTdhMjQ0YzNmMjJhNWYyMWM1MTAxOWU2NzM2NjMzNTA3MWZlNzlkMjIwZTAxOTE5NWZhMGRlZmEzNjhlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.NrxIUpQExGYHGoHDx4OXTjsQCgt3S0HZoanZ1rChnc8)
A microbenchmarking framework for Riot inspired by Elixir's benchee and Rust's criterion-rs.
opam pin riot git+https://github.com/leostera/riot
opam pin scarab git+https://github.com/leostera/scarab
And you can now create executables that use scarab
as a library:
(executable
(name my_bench)
(libraries scarab))
Here's an example benchmark:
Scarab.run ~name:"sums"
[
("sum 1", fun () -> sum 1);
("sum 100", fun () -> sum 100);
("sum 1_000", fun () -> sum 1_000);
("sum 2_000", fun () -> sum 2_000);
("sum 5_000", fun () -> sum 5_000);
("sum 10_000", fun () -> sum 10_000);
("sum 100_000", fun () -> sum 100_000);
]