diff options
| -rw-r--r-- | BENCHMARKS.md | 47 | ||||
| -rw-r--r-- | Cargo.lock | 771 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | benches/util/mod.rs | 6 |
4 files changed, 69 insertions, 756 deletions
diff --git a/BENCHMARKS.md b/BENCHMARKS.md index c86679c..13cbda9 100644 --- a/BENCHMARKS.md +++ b/BENCHMARKS.md @@ -1,10 +1,8 @@ # Benchmark results -All benchmarks are run on a Ryzen 7 5800X, with 32GB of RAM, running Linux 6.6 with `intel_pstate=passive split_lock_detect=off mitigations=off`. - -## Results - -Coming soon. +All benchmarks are run on a Ryzen 7 5800X, with 32GB of RAM, running Linux 6.6. +WebAssembly files are optimized using [wasm-opt](https://github.com/WebAssembly/binaryen) +and the benchmark code is available in the `benches` folder. ## WebAssembly Settings @@ -20,6 +18,43 @@ All runtimes are compiled with the following settings: - `unsafe` features are enabled - `opt-level` is set to 3, `lto` is set to `thin`, `codegen-units` is set to 1. +## Results + +| Benchmark | Native | TinyWasm | Wasmi | Wasmer (Single Pass) | +| ------------ | ------ | -------- | -------- | -------------------- | +| `argon2id` | 0.52ms | 110.08ms | 44.408ms | 4.76ms | +| `fib` | 6ns | 44.76µs | 48.96µs | 52µs | +| `fib-rec` | 284ns | 25.565ms | 5.11ms | 0.50ms | +| `selfhosted` | 45µs | 2.18ms | 4.25ms | 258.87ms | + +### Argon2id + +This benchmark runs the Argon2id hashing algorithm, with 2 iterations, 1KB of memory, and 1 parallel lane. +I had to decrease the memory usage from the default to 1KB, because especially the interpreters were struggling to finish in a reasonable amount of time. +This is something where `simd` instructions would be really useful, and it also highlights some of the issues with the current implementation of TinyWasm's Value Stack and Memory Instances. + +### Fib + +The first benchmark is a simple optimized Fibonacci function, which is a good way to show the overhead of calling functions and parsing the bytecode. +TinyWasm is slightly faster then Wasmi here, but that's probably because of the overhead of parsing the bytecode as TinyWasm uses a custom bytecode to pre-process the WebAssembly bytecode. + +### Fib-Rec + +This benchmark is a recursive Fibonacci function, which highlights some of the issues with the current implementation of TinyWasm's Call Stack. +TinyWasm is a lot slower here, but that's because there's currently no way to reuse the same Call Frame for recursive calls, so a new Call Frame is allocated for every call. This is not a problem for most programs, and the upcoming `tail-call` proposal will make this a lot easier to implement. + +### Selfhosted + +This benchmark runs TinyWasm itself in the VM, and parses and executes the `print.wasm` example from the `examples` folder. +This is a godd way to show some of TinyWasm's strengths - the code is pretty large at 702KB and Wasmer struggles massively with it, even with the Single Pass compiler. I think it's a decent real-world performance benchmark, but definitely favors TinyWasm a bit. + +Wasmer also offers a pre-parsed module format, so keep in mind that this number could be a bit lower if that was used (but probably still on the same order of magnitude). This number seems so high that I'm not sure if I'm doing something wrong, so I will be looking into this in the future. + +### Conclusion + +After profiling and fixing some low hanging fruits, I found the biggest bottleneck to be Vector operations, especially for the Value Stack, and having shared access to Memory Instances using RefCell. These are the two areas I will be focusing on improving in the future, trying out to use +Arena Allocation and other data structures to improve performance. Still, I'm quite happy with the results, especially considering the use of standard Rust data structures. Additionally, typed FuncHandles have a significant overhead over the untyped ones, so I will be looking into improving that as well. + # Running benchmarks Benchmarks are run using [Criterion.rs](https://github.com/bheisler/criterion.rs). To run a benchmark, use the following command: @@ -28,7 +63,7 @@ Benchmarks are run using [Criterion.rs](https://github.com/bheisler/criterion.rs $ cargo bench --bench <name> ``` -## Profiling +# Profiling To profile a benchmark, use the following command: @@ -29,18 +29,6 @@ dependencies = [ ] [[package]] -name = "ahash" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] name = "aho-corasick" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -77,18 +65,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] -name = "anyhow" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" - -[[package]] -name = "arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" - -[[package]] name = "argh" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -138,17 +114,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] -name = "async-trait" -version = "0.1.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -170,27 +135,12 @@ dependencies = [ ] [[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] name = "base64ct" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -322,7 +272,6 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "jobserver", "libc", ] @@ -503,15 +452,6 @@ dependencies = [ ] [[package]] -name = "cpp_demangle" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" -dependencies = [ - "cfg-if", -] - -[[package]] name = "cpufeatures" version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -526,16 +466,7 @@ version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2ab4512dfd3a6f4be184403a195f76e81a8a9f9e6c898e19d2dc3ce20e0115" dependencies = [ - "cranelift-entity 0.91.1", -] - -[[package]] -name = "cranelift-bforest" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d819feeda4c420a18f1e28236ca0ce1177b22bf7c8a44ddee92dfe40de15bcf0" -dependencies = [ - "cranelift-entity 0.104.0", + "cranelift-entity", ] [[package]] @@ -546,36 +477,15 @@ checksum = "98b022ed2a5913a38839dfbafe6cf135342661293b08049843362df4301261dc" dependencies = [ "arrayvec", "bumpalo", - "cranelift-bforest 0.91.1", - "cranelift-codegen-meta 0.91.1", - "cranelift-codegen-shared 0.91.1", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", "cranelift-egraph", - "cranelift-entity 0.91.1", - "cranelift-isle 0.91.1", + "cranelift-entity", + "cranelift-isle", "gimli 0.26.2", "log", - "regalloc2 0.5.1", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9b8d03d5bdbca7e5f72b0e0a0f69933ed1f09e24be6c075aa6fe3f802b0cc0c" -dependencies = [ - "bumpalo", - "cranelift-bforest 0.104.0", - "cranelift-codegen-meta 0.104.0", - "cranelift-codegen-shared 0.104.0", - "cranelift-control", - "cranelift-entity 0.104.0", - "cranelift-isle 0.104.0", - "gimli 0.28.1", - "hashbrown 0.14.3", - "log", - "regalloc2 0.9.3", + "regalloc2", "smallvec", "target-lexicon", ] @@ -586,16 +496,7 @@ version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "639307b45434ad112a98f8300c0f0ab085cbefcd767efcdef9ef19d4c0756e74" dependencies = [ - "cranelift-codegen-shared 0.91.1", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3fd3664e38e51649b17dc30cfdd561273fe2f590dcd013fb75d9eabc6272dfb" -dependencies = [ - "cranelift-codegen-shared 0.104.0", + "cranelift-codegen-shared", ] [[package]] @@ -605,30 +506,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "278e52e29c53fcf32431ef08406c295699a70306d05a0715c5b1bf50e33a9ab7" [[package]] -name = "cranelift-codegen-shared" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b031ec5e605828975952622b5a77d49126f20ffe88d33719a0af66b23a0fc36" - -[[package]] -name = "cranelift-control" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fada054d017cf2ed8f7ed2336e0517fc1b19e6825be1790de9eb00c94788362b" -dependencies = [ - "arbitrary", -] - -[[package]] name = "cranelift-egraph" version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624b54323b06e675293939311943ba82d323bb340468ce1889be5da7932c8d73" dependencies = [ - "cranelift-entity 0.91.1", + "cranelift-entity", "fxhash", "hashbrown 0.12.3", - "indexmap 1.9.3", + "indexmap", "log", "smallvec", ] @@ -640,34 +526,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a59bcbca89c3f1b70b93ab3cbba5e5e0cbf3e63dadb23c7525cb142e21a9d4c" [[package]] -name = "cranelift-entity" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177b6f94ae8de6348eb45bf977c79ab9e3c40fc3ac8cb7ed8109560ea39bee7d" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] name = "cranelift-frontend" version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d70abacb8cfef3dc8ff7e8836e9c1d70f7967dfdac824a4cd5e30223415aca6" dependencies = [ - "cranelift-codegen 0.91.1", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-frontend" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebebd23a69a23e3ddea78e98ff3a2de222e88c8e045d81ef4a72f042e0d79dbd" -dependencies = [ - "cranelift-codegen 0.104.0", + "cranelift-codegen", "log", "smallvec", "target-lexicon", @@ -680,39 +544,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "393bc73c451830ff8dbb3a07f61843d6cb41a084f9996319917c0b291ed785bb" [[package]] -name = "cranelift-isle" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1571bfc14df8966d12c6121b5325026591a4b4009e22fea0fe3765ab7cd33b96" - -[[package]] -name = "cranelift-native" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35a69c37e0c10b46fe5527f2397ac821046efbf5f7ec112c8b84df25712f465b" -dependencies = [ - "cranelift-codegen 0.104.0", - "libc", - "target-lexicon", -] - -[[package]] -name = "cranelift-wasm" -version = "0.104.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3fef8bbceb8cb56d3f1778b0418d75c5cf12ec571a35fc01eb41abb0227a25" -dependencies = [ - "cranelift-codegen 0.104.0", - "cranelift-entity 0.104.0", - "cranelift-frontend 0.104.0", - "itertools", - "log", - "smallvec", - "wasmparser 0.118.1", - "wasmtime-types", -] - -[[package]] name = "crc32fast" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -855,15 +686,6 @@ dependencies = [ ] [[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "uuid", -] - -[[package]] name = "derivative" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -886,16 +708,6 @@ dependencies = [ ] [[package]] -name = "directories-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] name = "dirs-next" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1030,12 +842,6 @@ dependencies = [ ] [[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] name = "errno" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1062,12 +868,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - -[[package]] name = "fdeflate" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1184,19 +984,6 @@ dependencies = [ ] [[package]] -name = "fxprof-processed-profile" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" -dependencies = [ - "bitflags 2.4.2", - "debugid", - "fxhash", - "serde", - "serde_json", -] - -[[package]] name = "generic-array" version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1233,8 +1020,8 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ - "fallible-iterator 0.2.0", - "indexmap 1.9.3", + "fallible-iterator", + "indexmap", "stable_deref_trait", ] @@ -1243,11 +1030,6 @@ name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -dependencies = [ - "fallible-iterator 0.3.0", - "indexmap 2.1.0", - "stable_deref_trait", -] [[package]] name = "globset" @@ -1278,16 +1060,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.7", + "ahash", ] [[package]] @@ -1295,15 +1068,6 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -dependencies = [ - "ahash 0.8.7", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -1341,12 +1105,6 @@ dependencies = [ ] [[package]] -name = "id-arena" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" - -[[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1393,17 +1151,6 @@ dependencies = [ ] [[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown 0.14.3", - "serde", -] - -[[package]] name = "indexmap-nostd" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1436,35 +1183,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] -name = "ittapi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" -dependencies = [ - "anyhow", - "ittapi-sys", - "log", -] - -[[package]] -name = "ittapi-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" -dependencies = [ - "cc", -] - -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] name = "jpeg-decoder" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1562,15 +1280,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] -name = "memfd" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" -dependencies = [ - "rustix", -] - -[[package]] name = "memmap2" version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1598,15 +1307,6 @@ dependencies = [ ] [[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - -[[package]] name = "miniz_oxide" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1637,9 +1337,6 @@ version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ - "crc32fast", - "hashbrown 0.14.3", - "indexmap 2.1.0", "memchr", ] @@ -1837,15 +1534,6 @@ dependencies = [ ] [[package]] -name = "psm" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" -dependencies = [ - "cc", -] - -[[package]] name = "ptr_meta" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1939,19 +1627,6 @@ dependencies = [ ] [[package]] -name = "regalloc2" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" -dependencies = [ - "hashbrown 0.13.2", - "log", - "rustc-hash", - "slice-group-by", - "smallvec", -] - -[[package]] name = "regex" version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2011,7 +1686,7 @@ dependencies = [ "bytecheck 0.6.11", "bytes", "hashbrown 0.12.3", - "indexmap 1.9.3", + "indexmap", "ptr_meta", "rend", "rkyv_derive", @@ -2073,12 +1748,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2242,12 +1911,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] -name = "sptr" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" - -[[package]] name = "stable_deref_trait" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2406,7 +2069,6 @@ dependencies = [ "tinywasm", "wasmer", "wasmi", - "wasmtime", "wat", ] @@ -2420,15 +2082,6 @@ dependencies = [ ] [[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] name = "tracing" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2521,12 +2174,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] name = "url" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2650,15 +2297,6 @@ checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-encoder" -version = "0.38.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "111495d6204760238512f57a9af162f45086504da332af210f2f75dd80b34f1d" @@ -2682,7 +2320,7 @@ dependencies = [ "bytes", "cfg-if", "derivative", - "indexmap 1.9.3", + "indexmap", "js-sys", "more-asserts", "rustc-demangle", @@ -2726,7 +2364,7 @@ dependencies = [ "thiserror", "wasmer-types", "wasmer-vm", - "wasmparser 0.95.0", + "wasmparser", "winapi", ] @@ -2736,9 +2374,9 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d96bce6fad15a954edcfc2749b59e47ea7de524b6ef3df392035636491a40b4" dependencies = [ - "cranelift-codegen 0.91.1", - "cranelift-entity 0.91.1", - "cranelift-frontend 0.91.1", + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", "gimli 0.26.2", "more-asserts", "rayon", @@ -2789,7 +2427,7 @@ dependencies = [ "bytecheck 0.6.11", "enum-iterator", "enumset", - "indexmap 1.9.3", + "indexmap", "more-asserts", "rkyv", "target-lexicon", @@ -2811,11 +2449,11 @@ dependencies = [ "derivative", "enum-iterator", "fnv", - "indexmap 1.9.3", + "indexmap", "lazy_static", "libc", "mach", - "memoffset 0.8.0", + "memoffset", "more-asserts", "region", "scopeguard", @@ -2861,21 +2499,11 @@ version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" dependencies = [ - "indexmap 1.9.3", + "indexmap", "url", ] [[package]] -name = "wasmparser" -version = "0.118.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" -dependencies = [ - "indexmap 2.1.0", - "semver", -] - -[[package]] name = "wasmparser-nostd" version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2885,289 +2513,6 @@ dependencies = [ ] [[package]] -name = "wasmtime" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "910fabce77e660f0e0e41cfd5f69fc8bf020a025f059718846e918db7177f469" -dependencies = [ - "anyhow", - "async-trait", - "bincode", - "bumpalo", - "cfg-if", - "fxprof-processed-profile", - "indexmap 2.1.0", - "libc", - "log", - "object", - "once_cell", - "paste", - "rayon", - "serde", - "serde_derive", - "serde_json", - "target-lexicon", - "wasm-encoder 0.38.1", - "wasmparser 0.118.1", - "wasmtime-cache", - "wasmtime-component-macro", - "wasmtime-cranelift", - "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-jit", - "wasmtime-runtime", - "wat", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-asm-macros" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37288142e9b4a61655a3bcbdc7316c2e4bb9e776b10ce3dd758f8186b4469572" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "wasmtime-cache" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45cbd74a636f09d2108f9405c79857f061e19323e4abeed22e837cfe7b08a22b" -dependencies = [ - "anyhow", - "base64", - "bincode", - "directories-next", - "log", - "rustix", - "serde", - "serde_derive", - "sha2", - "toml", - "windows-sys 0.52.0", - "zstd", -] - -[[package]] -name = "wasmtime-component-macro" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad63de18eb42e586386b6091f787c82707cbd5ac5e9343216dba1976190cd03a" -dependencies = [ - "anyhow", - "proc-macro2", - "quote", - "syn 2.0.48", - "wasmtime-component-util", - "wasmtime-wit-bindgen", - "wit-parser", -] - -[[package]] -name = "wasmtime-component-util" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0a160c0c44369aa4bee6d311a8e4366943bab1651040cc8b0fcec2c9eb8906" - -[[package]] -name = "wasmtime-cranelift" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3734cc01b7cd37bc62fdbcd9529ca9547440052d4b3886cfdec3b8081a5d3647" -dependencies = [ - "anyhow", - "cfg-if", - "cranelift-codegen 0.104.0", - "cranelift-control", - "cranelift-entity 0.104.0", - "cranelift-frontend 0.104.0", - "cranelift-native", - "cranelift-wasm", - "gimli 0.28.1", - "log", - "object", - "target-lexicon", - "thiserror", - "wasmparser 0.118.1", - "wasmtime-cranelift-shared", - "wasmtime-environ", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-cranelift-shared" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0eb33cd30c47844aa228d4d0030587e65c1108343f311fe9f7248b5bd9cb65c" -dependencies = [ - "anyhow", - "cranelift-codegen 0.104.0", - "cranelift-control", - "cranelift-native", - "gimli 0.28.1", - "object", - "target-lexicon", - "wasmtime-environ", -] - -[[package]] -name = "wasmtime-environ" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a056b041fdea604f0972e2fae97958e7748d629a55180228348baefdfc217" -dependencies = [ - "anyhow", - "cranelift-entity 0.104.0", - "gimli 0.28.1", - "indexmap 2.1.0", - "log", - "object", - "serde", - "serde_derive", - "target-lexicon", - "thiserror", - "wasmparser 0.118.1", - "wasmtime-types", -] - -[[package]] -name = "wasmtime-fiber" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43987d0977c07f15c3608c2f255870c127ffd19e35eeedb1ac1dccedf9932a42" -dependencies = [ - "anyhow", - "cc", - "cfg-if", - "rustix", - "wasmtime-asm-macros", - "wasmtime-versioned-export-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-jit" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3e48395ac672b386ed588d97a9612aa13a345008f26466f0dfb2a91628aa9f" -dependencies = [ - "addr2line", - "anyhow", - "bincode", - "cfg-if", - "cpp_demangle", - "gimli 0.28.1", - "ittapi", - "log", - "object", - "rustc-demangle", - "rustix", - "serde", - "serde_derive", - "target-lexicon", - "wasmtime-environ", - "wasmtime-jit-debug", - "wasmtime-jit-icache-coherence", - "wasmtime-runtime", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-jit-debug" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd21fd0f5ca68681d3d5b636eea00f182d0f9d764144469e9257fd7e3f55ae0e" -dependencies = [ - "object", - "once_cell", - "rustix", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-jit-icache-coherence" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdc26415bb89e9ccd3bdc498fef63aabf665c4c0dd710c107691deb9694955da" -dependencies = [ - "cfg-if", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-runtime" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0abddaf17912aabaf39be0802d5eba9a002e956e902d1ebd438a2fe1c88769a2" -dependencies = [ - "anyhow", - "cc", - "cfg-if", - "indexmap 2.1.0", - "libc", - "log", - "mach", - "memfd", - "memoffset 0.9.0", - "paste", - "psm", - "rustix", - "sptr", - "wasm-encoder 0.38.1", - "wasmtime-asm-macros", - "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-jit-debug", - "wasmtime-versioned-export-macros", - "wasmtime-wmemcheck", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-types" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35a95cdc1433729085beab42c0a5c742b431f25b17c40d7718e46df63d5ffc7" -dependencies = [ - "cranelift-entity 0.104.0", - "serde", - "serde_derive", - "thiserror", - "wasmparser 0.118.1", -] - -[[package]] -name = "wasmtime-versioned-export-macros" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad322733fe67e45743784d8b1df452bcb54f581572a4f1a646a4332deecbcc2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "wasmtime-wit-bindgen" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41e5675998fdc74495afdd90ad2bd221206a258075b23048af0535a969b07893" -dependencies = [ - "anyhow", - "heck", - "indexmap 2.1.0", - "wit-parser", -] - -[[package]] -name = "wasmtime-wmemcheck" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b20a19e10d8cb50b45412fb21192982b7ce85c0122dc33bb71f1813e25dc6e52" - -[[package]] name = "wast" version = "70.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3176,7 +2521,7 @@ dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.39.0", + "wasm-encoder", ] [[package]] @@ -3429,23 +2774,6 @@ dependencies = [ ] [[package]] -name = "wit-parser" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df4913a2219096373fd6512adead1fb77ecdaa59d7fc517972a7d30b12f625be" -dependencies = [ - "anyhow", - "id-arena", - "indexmap 2.1.0", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", -] - -[[package]] name = "wyz" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3465,52 +2793,3 @@ dependencies = [ "once_cell", "pkg-config", ] - -[[package]] -name = "zerocopy" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", -] @@ -52,5 +52,4 @@ tinywasm={path="crates/tinywasm", features=["unsafe"]} wat={version="1.0"} wasmi={version="0.31", features=["std"]} wasmer={version="4.2", features=["cranelift", "singlepass"]} -wasmtime={version="17.0", features=["cranelift"]} argon2={version="0.5"} diff --git a/benches/util/mod.rs b/benches/util/mod.rs index aa7b418..03e2075 100644 --- a/benches/util/mod.rs +++ b/benches/util/mod.rs @@ -33,10 +33,10 @@ pub fn wasmi(wasm: &[u8]) -> (wasmi::Module, wasmi::Store<()>, wasmi::Linker<()> pub fn wasmer(wasm: &[u8]) -> (wasmer::Store, wasmer::Instance) { use wasmer::*; - let engine: Engine = wasmer::Singlepass::default().into(); - let mut store = Store::default(); + let compiler = Singlepass::default(); + let mut store = Store::new(compiler); let import_object = imports! {}; - let module = wasmer::Module::from_binary(&engine, &wasm).expect("wasmer::Module::from_binary"); + let module = Module::new(&store, wasm).expect("wasmer::Module::new"); let instance = Instance::new(&mut store, &module, &import_object).expect("Instance::new"); (store, instance) } |
