基准测试
Rust支持基准测试来测试用户代码的性能。我们来看一下 src/lib.rs 的性能如何。`#![feature(test)]extern crate test;pub fn add_two(a: i32) -> i32 { a + 2}#[cfg(test)]mod tests {use super::*;use test::Bencher;#[test]fn it_works() { assert_eq!(4, add_two(2));}#[bench]fn bench_add_two(b: &mut Bencher) { b.
欢马劈雪