aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-05-24 15:44:09 -0700
committeriximeow <me@iximeow.net>2020-05-24 15:44:09 -0700
commit1056fe08ddf0c1e7f7c3b10e9e6cafbf295ce632 (patch)
tree581e3127df712817820c55e61be00fce23c2c009
parentec91652b25acba3ab9f5c5e2b8b9ae497c3d6474 (diff)
fix benchmark bitrotmaster
-rw-r--r--test/bench.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/bench.rs b/test/bench.rs
index 1048a1c..486fa6e 100644
--- a/test/bench.rs
+++ b/test/bench.rs
@@ -2,6 +2,8 @@
extern crate test;
extern crate yaxpeax_x86;
+extern crate yaxpeax_arch;
+use yaxpeax_arch::Decoder;
#[cfg(feature = "capstone_bench")]
use std::ffi::c_void;
@@ -24,9 +26,9 @@ fn decode(bytes: &[u8]) -> Option<Instruction> {
*/
#[bench]
-fn bench_102000_instrs(b: &mut Bencher) {
+fn bench_1020000_instrs(b: &mut Bencher) {
b.iter(|| {
- for _i in 0..3000 {
+ for _i in 0..30000 {
test::black_box(do_decode_swathe());
}
})
@@ -86,15 +88,16 @@ const DECODE_DATA: [u8; 130] = [
fn do_decode_swathe() {
// let mut buf = [0u8; 128];
let mut iter = DECODE_DATA.iter().map(|x| *x);
- let mut result = yaxpeax_x86::Instruction::invalid();
+ let mut result = yaxpeax_x86::long_mode::Instruction::invalid();
+ let decoder = yaxpeax_x86::long_mode::InstDecoder::default();
loop {
- match yaxpeax_x86::decode_one(&mut iter, &mut result) {
- Some(_) => {
+ match decoder.decode_into(&mut result, &mut iter) {
+ Ok(()) => {
#[cfg(feature = "capstone_bench")]
test::black_box(write!(&mut buf[..], "{}", result));
test::black_box(&result);
},
- None => {
+ Err(_) => {
// println!("done.");
break;
}