#![feature(test)] extern crate test; use himpp::mpi::{ nnie, nnie::{SvpMemInfoLoader, SvpNnieModelLoader}, }; use test::Bencher; #[bench] fn bench_svp_mem_info_loader(b: &mut Bencher) { b.iter(|| { let loader = SvpMemInfoLoader::from_bytes(include_bytes!( "../examples/data/nnie/inst_mnist_cycle.wk" )); assert_eq!(loader.is_ready(), true); }); } #[bench] fn bench_svp_nnie_model_loader(b: &mut Bencher) { b.iter(|| { let loader = SvpNnieModelLoader::from_bytes(include_bytes!( "../examples/data/nnie/inst_mnist_cycle.wk" )); assert_eq!(loader.is_ready(), true); }); } #[bench] fn bench_svp_nnie_model_load_unload(b: &mut Bencher) { let loader = SvpMemInfoLoader::from_bytes(include_bytes!("../examples/data/nnie/inst_mnist_cycle.wk")); b.iter(|| { let r = nnie::load_model(&loader); assert_eq!(r.is_ok(), true); if let Ok(ref model) = r { assert_eq!(nnie::unload_model(model).is_ok(), true); } }); }