Mossaka opened issue #6353:
It takes 20 seconds to load a component in
wasmtime 7.0.0
. It is definitely much slower than loading a wasm module of comparable size. Is this expected? What could be the cause?wasm component file size: 6.9M
let start = Instant::now(); let component = Component::from_file(&engine, &input).unwrap(); let elapsed = start.elapsed(); println!("Time to load: {:?}", elapsed);
Time to load: 20.891809886s
alexcrichton commented on issue #6353:
Definitely unexpected! Do you have a component you could share to reproduce with?
Mossaka commented on issue #6353:
I do. If you clone down this repo, and then do
make install-js make build-js
You will get a component called
js.component.wasm
.You can run with
cargo run --js.component.wasm
alexcrichton commented on issue #6353:
Sorry won't get a chance to dig into this today, but from what you pasted I think
--release
is missing? Otherwise that's building in debug mode and it's known that debug mode is much slower than release for Cranelift.
alexcrichton commented on issue #6353:
Testing locally my guess is that this is
--release
-vs-not. Your command above,cargo run --js.component.wasm
, is not a valid invocation of Cargo however since it thinks--js.component.wasm
is an argument. Given that I'm not sure what you meant to paste there, so I'm not sure if for you it'l lbe--release
-vs-not.
Mossaka commented on issue #6353:
Ah yes thanks so much! The issue is indeed that I didn't pass
--release
.With release mode, the time to load the component is
1.2s
. Will close this issue.
Mossaka closed issue #6353:
It takes 20 seconds to load a component in
wasmtime 7.0.0
. It is definitely much slower than loading a wasm module of comparable size. Is this expected? What could be the cause?wasm component file size: 6.9M
let start = Instant::now(); let component = Component::from_file(&engine, &input).unwrap(); let elapsed = start.elapsed(); println!("Time to load: {:?}", elapsed);
Time to load: 20.891809886s
Mossaka reopened issue #6353:
It takes 20 seconds to load a component in
wasmtime 7.0.0
. It is definitely much slower than loading a wasm module of comparable size. Is this expected? What could be the cause?wasm component file size: 6.9M
let start = Instant::now(); let component = Component::from_file(&engine, &input).unwrap(); let elapsed = start.elapsed(); println!("Time to load: {:?}", elapsed);
Time to load: 20.891809886s
Mossaka commented on issue #6353:
Actually, I also tried to load a rust-produced wasm component with 2.0M size. The loading time is
20ms
, which is, suprisingly, significantly faster than the js component. Is this expected?
Mossaka commented on issue #6353:
➜ ./target/release/wit-bindgen-go-template js.component.wasm Time to load: 1.200816367s ➜ ./target/release/wit-bindgen-go-template rust.component.wasm Time to load: 20.610888ms ➜ ls rust.component.wasm rust.component.wasm ➜ l rust.component.wasm .rwxrwxr-x 2.0Mi mossaka 2 May 22:10 -I rust.component.wasm* ➜ l js.component.wasm .rw-rw-r-- 6.5Mi mossaka 8 May 19:06 -I js.component.wasm
Mossaka edited a comment on issue #6353:
➜ ./target/release/wit-bindgen-go-template js.component.wasm Time to load: 1.200816367s ➜ ./target/release/wit-bindgen-go-template rust.component.wasm Time to load: 20.610888ms ➜ l rust.component.wasm .rwxrwxr-x 2.0Mi mossaka 2 May 22:10 -I rust.component.wasm* ➜ l js.component.wasm .rw-rw-r-- 6.5Mi mossaka 8 May 19:06 -I js.component.wasm
alexcrichton commented on issue #6353:
Can you upload the
{js,rust}.component.wasm
binaries here as well? In general though yes it's probalby the case that JS is going to be longer to compile than Rust since JS has all of spidermonkey or some other JS engine
Mossaka commented on issue #6353:
Unfortunately I was not able to upload a *.wasm file here because it's not a supported file type.
alexcrichton commented on issue #6353:
Ah right, yes, but you can
gzip
the components and upload them. (or maybe even rename it tofoo.gz
and upload it, I don't think the check is that restrictive)
tschneidereit commented on issue #6353:
I'd bet that the Rust component includes debug info, and that the code section is actually much smaller, and hence faster to compile
Mossaka commented on issue #6353:
Mossaka edited a comment on issue #6353:
Sorry for getting back to you late. Here are the gz files
alexcrichton commented on issue #6353:
Ok yes I can confirm that the compile times are effectively as expected. The Rust component is almost entirely debug information which can be stripped out with
wasm-tools strip
, where the JS component is almost entirely code (it is spidermonkey after all).Given that I'm going to close this as expected where
--release
definitely should be enabled for Cranelift and the compilation pipeline, and it's expected that a JS component compiles more slowly than a Rust component.
alexcrichton closed issue #6353:
It takes 20 seconds to load a component in
wasmtime 7.0.0
. It is definitely much slower than loading a wasm module of comparable size. Is this expected? What could be the cause?wasm component file size: 6.9M
let start = Instant::now(); let component = Component::from_file(&engine, &input).unwrap(); let elapsed = start.elapsed(); println!("Time to load: {:?}", elapsed);
Time to load: 20.891809886s
Last updated: Nov 22 2024 at 16:03 UTC