Rust bench 実行時間測定

rustである関数の実行時間を測定したいときがあったのでメモ 環境 rustc --version rustc 1.24.0-nightly (f8af59d95 2017-12-13)rustc-testクレートが必要なのでCargo.tomlに記述する。 extern crate test; use test::test::Bencher; struct Fx { a: f64, b: f64, dx: f64, f: fn(f64) -> f64, } impl Fx { fn new(a: f64…