-
Notifications
You must be signed in to change notification settings - Fork 7
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
Atomic condition variable #5
Comments
From a quick look in the V8 source code it looks notify is implemented verbatim with the spec without any optimisations, i.e. there is no fast path such as just checking the stored value, and it also uses a global mutex, every time. |
Can you provide a micro-benchmark? |
Not really... what would I compare it with? |
I assume it is: |
Tricky to benchmark due to async stuff. We would need to measure cpu utilization instead of ops per second. |
I've noticed that using
Atomics.notify
+Atomics.waitAsync
is extremely slow. Just doing a normalAtomics.load
+setTimeout
polling loop is a lot faster.Since Atomics is implemented in V8 I'm not sure there is much we can do about it. Other than maybe adding notes in our docs.
Refs: https://github.com/pinojs/thread-stream/blob/main/lib/wait.js
Refs: https://bugs.chromium.org/p/v8/issues/detail?id=13483
The text was updated successfully, but these errors were encountered: