diff --git a/benchmarks/bench.rs b/benchmarks/bench.rs index 84c91be28..7f27f0a1e 100644 --- a/benchmarks/bench.rs +++ b/benchmarks/bench.rs @@ -94,15 +94,14 @@ fn bench_rustpy_nbody(b: &mut test::Bencher) { let vm = VirtualMachine::default(); - let code = match vm.compile(source, compile::Mode::Single, "".to_owned()) { - Ok(code) => code, - Err(e) => panic!("{:?}", e), - }; + let code = vm + .compile(source, compile::Mode::Exec, "".to_owned()) + .unwrap(); b.iter(|| { let scope = vm.new_scope_with_builtins(); let res: PyResult = vm.run_code_obj(code.clone(), scope); - assert!(res.is_ok()); + vm.unwrap_pyresult(res); }) } @@ -113,14 +112,13 @@ fn bench_rustpy_mandelbrot(b: &mut test::Bencher) { let vm = VirtualMachine::default(); - let code = match vm.compile(source, compile::Mode::Single, "".to_owned()) { - Ok(code) => code, - Err(e) => panic!("{:?}", e), - }; + let code = vm + .compile(source, compile::Mode::Exec, "".to_owned()) + .unwrap(); b.iter(|| { let scope = vm.new_scope_with_builtins(); let res: PyResult = vm.run_code_obj(code.clone(), scope); - assert!(res.is_ok()); + vm.unwrap_pyresult(res); }) }