summaryrefslogtreecommitdiff
path: root/benchmarks/benches/util
diff options
context:
space:
mode:
authorHenry Gressmann <mail@henrygressmann.de>2024-05-10 18:08:00 +0200
committerHenry Gressmann <mail@henrygressmann.de>2024-05-10 19:22:29 +0200
commit868aa006b7f1eabffd4aec3a03555012148a7df1 (patch)
tree164722ac37b3efb0f40bcf53925b7e79dc6493c1 /benchmarks/benches/util
parent2ac04cd653898786caca198726e6b9938185b76a (diff)
chore: slight perf improvements
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'benchmarks/benches/util')
-rw-r--r--benchmarks/benches/util/mod.rs22
1 files changed, 2 insertions, 20 deletions
diff --git a/benchmarks/benches/util/mod.rs b/benchmarks/benches/util/mod.rs
index f75ce66..2961046 100644
--- a/benchmarks/benches/util/mod.rs
+++ b/benchmarks/benches/util/mod.rs
@@ -1,26 +1,8 @@
#![allow(dead_code)]
-use tinywasm::{parser::Parser, types::TinyWasmModule};
-
-pub fn parse_wasm(wasm: &[u8]) -> TinyWasmModule {
- let parser = Parser::new();
- parser.parse_module_bytes(wasm).expect("parse_module_bytes")
-}
-
-pub fn wasm_to_twasm(wasm: &[u8]) -> Vec<u8> {
- let parser = Parser::new();
- let res = parser.parse_module_bytes(wasm).expect("parse_module_bytes");
- res.serialize_twasm().to_vec()
-}
-
-#[inline]
-pub fn twasm_to_module(twasm: &[u8]) -> tinywasm::Module {
- unsafe { TinyWasmModule::from_twasm_unchecked(twasm) }.into()
-}
-
-pub fn tinywasm(twasm: &[u8]) -> (tinywasm::Store, tinywasm::ModuleInstance) {
+pub fn tinywasm(wasm: &[u8]) -> (tinywasm::Store, tinywasm::ModuleInstance) {
use tinywasm::*;
- let module = twasm_to_module(twasm);
+ let module = Module::parse_bytes(wasm).expect("Module::parse_bytes");
let mut store = Store::default();
let imports = Imports::default();
let instance = ModuleInstance::instantiate(&mut store, module, Some(imports)).expect("instantiate");