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

Replace stack pool mutex with lock-free queue #4196

Merged
merged 2 commits into from
Sep 1, 2023

Conversation

Arshia001
Copy link
Member

Alternate implementation of #3922 using a lock-free queue instead of thread locals. I benchmarked this by creating 100 threads and running a simple WASM function in a loop 30,000 times in each thread. This PR reduces the total time by ~75% on my 10-core CPU, and does not create meaningful impact on single-threaded performance. Also, since the queue is shared among threads, there is no risk of high memory consumption in highly concurrent scenarios.

Copy link
Contributor

@theduke theduke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this approach is preferable, let's go with it.

lib/vm/src/trap/traphandlers.rs Show resolved Hide resolved
@Arshia001 Arshia001 enabled auto-merge September 1, 2023 13:38
@Arshia001 Arshia001 merged commit c8f74f3 into master Sep 1, 2023
@Arshia001 Arshia001 deleted the fix-remove-stack-lock branch September 1, 2023 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants