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

Circular buffer for parked worker threads and removed lock #1466

Merged
merged 1 commit into from
Dec 4, 2020
Merged

Circular buffer for parked worker threads and removed lock #1466

merged 1 commit into from
Dec 4, 2020

Conversation

vasilmkd
Copy link
Member

Corroborated by benchmark improvements

WorkStealingBenchmark.async before:
10.660 +- 0.529

WorkStealingBenchmark.async after:
11.078 +- 0.218

@vasilmkd vasilmkd added the CE 3 label Nov 30, 2020
Copy link
Member

@djspiewak djspiewak left a comment

Choose a reason for hiding this comment

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

Very very nice

Comment on lines +53 to +62
while ({
hd = head.get()
tl = tail.get()

if (hd == tl)
return null

idx = hd
!head.compareAndSet(hd, hd + 1)
}) ()
Copy link
Member

Choose a reason for hiding this comment

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

Officially the most hilarious while loop formulation I've ever seen. I know it's just encoding do/while, but still.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the recommended way to do it in the Dotty docs, just fyi. :)

@djspiewak djspiewak merged commit 55fe187 into typelevel:series/3.x Dec 4, 2020
@vasilmkd vasilmkd deleted the circular branch February 3, 2021 22:46
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