Skip to content

Surprisingly slow module compilation #2662

@wycats

Description

@wycats

Thanks for opening a bug report! Please answer the questions below
if they're relevant and delete this text before submitting.

  • What are the steps to reproduce the issue?

I have pushed a repository at https://github.com/wycats/wand/tree/str-wasmtime. The branch str-wasmtime is self-contained.

The script ./script/all.sh runs all of the build steps. The final step, ./script/run.sh, runs an executable, which is a Rust executable that uses the wasmtime embedding API. Its source is located in ./crates/wand-cli. The Rust source for the wasm is located in ./src.

The build scripts use wasm-pack to compile and optimize the wasm. They copy the .wasm file into a data directory in the wand-cli crate, which uses include_bytes! to get the bytes.

The executable has a bunch of println!s that list out the execution steps and how much time has elapsed.

  • What do you expect to happen? What does actually happen? Does it panic, and
    if so, with which assertion?

I expect the Module::new step to be relatively fast. Instead, it takes several seconds on my machine.

  • Which Wasmtime version / commit hash / branch are you using?

0.22.

  • If relevant, can you include some extra information about your environment?
    (Rust version, operating system, architecture...)
$ rustc --version
rustc 1.52.0-nightly (d1206f950 2021-02-15)
$ cargo --version
cargo 1.51.0-nightly (ab64d1393 2021-02-10)
$ uname -a
Linux XPS-13-2019 4.19.84-microsoft-standard #1 SMP Wed Nov 13 11:44:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal

I'm on Ubuntu 20.04 inside of WSL2 on Windows 10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions