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

Use parking_lot sync primitives #32

Closed
wants to merge 1 commit into from

Conversation

jzajpt
Copy link

@jzajpt jzajpt commented Jun 7, 2021

Use Mutex, RwLock and others from parking_lot crate instead of std::sync

@Pauan
Copy link
Owner

Pauan commented Jun 7, 2021

Thanks, but there's a few issues with using parking_lot:

  1. For usage on Wasm, you have to use the nightly compiler and enable the wasm-bindgen feature, which is quite annoying (and a breaking change for all Wasm consumers).
  2. There are issues with using parking_lot on Wasm.
  3. The stdlib implementation for Mutex and RwLock on Wasm should be quite a lot faster than parking_lot.
  4. There are plans to implement parking_lot directly in the stdlib, though unfortunately it seems those plans have stalled.

So if we're going to implement parking_lot, it would have to be as an optional dependency (which also means using cfg to choose the right implementation at compile time). That's a quite large change.

I am aware of the speed benefits of parking_lot (which is why the code has a TODO about it), but are the performance benefits worth the above problems? I'm not sure.

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