Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue during Drop of wasmtime::Module #10287

Closed
jaybarbhaiya opened this issue Feb 24, 2025 · 2 comments
Closed

Performance issue during Drop of wasmtime::Module #10287

jaybarbhaiya opened this issue Feb 24, 2025 · 2 comments
Labels
bug Incorrect behavior in the current implementation that needs fixing

Comments

@jaybarbhaiya
Copy link

Thanks for filing a bug report! Please fill out the TODOs below.

Note: if you want to report a security issue, please read our security policy!

Test Case

Wasm file

Steps to Reproduce

  • Clone the repo
git clone https://github.com/jaybarbhaiya/wasmtime-module-drop-test.git
  • Run bench command
cargo bench

Expected Results

The time taken to drop a wasmtime::Module should be comparable across different operating systems.

Actual Results

The drop of a wasmtime::Module in MacOS is significantly higher than that of Linux and Windows.

Versions and Environment

Wasmtime version or commit: 30.0.1

Operating system: MacOS 15.3.1

Architecture: arm64

Extra Info

1000 wasmtime::Module are created with the wasm binary attached above and then dropped. GitHub actions are set up in the repo, which runs the cargo bench command in ubuntu-latest, windows-latest, and macos-latest runners. The screenshot below shows the results:

ubuntu-latest
Image

windows-latest
Image

macos-latest
Image

The difference that was observed, in MacOS, the wasmtime::CodeMemory drop takes a significant amount of time which is not the case in Linux. It would be valuable to get some insights.

Thank you.

@jaybarbhaiya jaybarbhaiya added the bug Incorrect behavior in the current implementation that needs fixing label Feb 24, 2025
@alexcrichton
Copy link
Member

Thanks for the report! This is likely the cause of Config::native_unwind_info being default-on. OSes have widely varying implementations of how information is unregistered, and IIRC I've also seen macOS be significantly slower than other platforms.

If that option is disabled, though, does it improve the performance you're seeing?

@jaybarbhaiya
Copy link
Author

Hi @alexcrichton
Thank you for the quick response!
Disabling Config::native_unwind_info improved performance. Please see below the updated benchmark from the macOS GitHub runner.

Image

Thank you again for the clarification 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing
Projects
None yet
Development

No branches or pull requests

2 participants