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

Improve callback interface performance (busy waiting) #29

Open
skeet70 opened this issue Aug 12, 2024 · 1 comment
Open

Improve callback interface performance (busy waiting) #29

skeet70 opened this issue Aug 12, 2024 · 1 comment

Comments

@skeet70
Copy link
Member

skeet70 commented Aug 12, 2024

In this experiment we discovered that Java's CompletableFuture .get() blocks then suspends the thread it's on. Apparently when .complete() on that CompletableFuture is supposed to wake the suspended thread, but it's not working consistently (sometimes wakes within 2ms like it should, sometimes not till after 200ms).

For MVP we're moving forward with the busy wait, but if there's a more efficient technique that actually works, we should really use it.

The test for this is the assert traitObj.completedDelays == completedDelaysBefore in TestFixtureFutures. For anything to be considered working that should pass at least 100 times. Use CI tests if possible, they're much more consistent than reproducing locally.

@skeet70
Copy link
Member Author

skeet70 commented Aug 12, 2024

One thought for this is using CountdownLatch instead of CompletableFuture for the callback from Rust in the callback map. May have the same issue of waking that CFs do though, needs testing.

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

No branches or pull requests

1 participant