Skip to content

Commit 4aee595

Browse files
committed
Fix benchmarks (maybe?)
1 parent be565d3 commit 4aee595

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

benchmarks/bench.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,14 @@ fn bench_rustpy_nbody(b: &mut test::Bencher) {
9494

9595
let vm = VirtualMachine::default();
9696

97-
let code = match vm.compile(source, compile::Mode::Single, "<stdin>".to_owned()) {
98-
Ok(code) => code,
99-
Err(e) => panic!("{:?}", e),
100-
};
97+
let code = vm
98+
.compile(source, compile::Mode::Exec, "<stdin>".to_owned())
99+
.unwrap();
101100

102101
b.iter(|| {
103102
let scope = vm.new_scope_with_builtins();
104103
let res: PyResult = vm.run_code_obj(code.clone(), scope);
105-
assert!(res.is_ok());
104+
vm.unwrap_pyresult(res);
106105
})
107106
}
108107

@@ -113,14 +112,13 @@ fn bench_rustpy_mandelbrot(b: &mut test::Bencher) {
113112

114113
let vm = VirtualMachine::default();
115114

116-
let code = match vm.compile(source, compile::Mode::Single, "<stdin>".to_owned()) {
117-
Ok(code) => code,
118-
Err(e) => panic!("{:?}", e),
119-
};
115+
let code = vm
116+
.compile(source, compile::Mode::Exec, "<stdin>".to_owned())
117+
.unwrap();
120118

121119
b.iter(|| {
122120
let scope = vm.new_scope_with_builtins();
123121
let res: PyResult = vm.run_code_obj(code.clone(), scope);
124-
assert!(res.is_ok());
122+
vm.unwrap_pyresult(res);
125123
})
126124
}

0 commit comments

Comments
 (0)