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

Create Loom-friendly concurrent weak set (FiberSet) #8861

Open
jdegoes opened this issue May 15, 2024 · 9 comments
Open

Create Loom-friendly concurrent weak set (FiberSet) #8861

jdegoes opened this issue May 15, 2024 · 9 comments

Comments

@jdegoes
Copy link
Member

jdegoes commented May 15, 2024

At various points in ZIO, we need the ability to hold onto a set or bag of fibers. We need the ability to concurrently add and remove items from this set / bag, without synchronization or other locks. Finally, we need concurrent (and eventually consistent) iteration over this set / bag.

Ensuring there are no duplicates is not really important, nor does it ever happen, so the "set" aspect of this need not be enforced, which can potentially lead to a more efficient implementation.

Finally, weak references are slow. It would be nice to avoid them entirely, but that's not possible since some fibers are suspended forever and do not shut down cleanly, so garbage collection is necessary to preserve.

However, it's possible using reference queue or other techniques, we could reduce the number of weak refs we create.

This ticket is for implementation of such a high-performance structure, benchmarks showing superior performance, and comprehensive test suite; together with incorporating this weak concurrent set into the Fiber children set, and the set of root fibers.

@jdegoes
Copy link
Member Author

jdegoes commented May 15, 2024

/bounty $1500

Copy link

algora-pbc bot commented May 15, 2024

💎 $1,500 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #8861 with your implementation plan
  2. Submit work: Create a pull request including /claim #8861 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Additional opportunities:

Thank you for contributing to zio/zio!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🔴 @kyri-petrou May 16, 2024, 10:48:18 AM WIP
🔴 @snigdha510 May 17, 2024, 6:35:18 AM WIP

@jdegoes
Copy link
Member Author

jdegoes commented May 15, 2024

cc @kyri-petrou

@kyri-petrou
Copy link
Contributor

kyri-petrou commented May 16, 2024

/attempt #8861

Got an approach in mind that's looking feasible so far. If all goes well I'm hoping to have a draft PR for it next week

Algora profile Completed bounties Tech Active attempts Options
@kyri-petrou 9 ZIO bounties
Scala, Python,
Shell & more
Cancel attempt

@snigdha510
Copy link

snigdha510 commented May 17, 2024

/attempt #8861

Copy link

algora-pbc bot commented May 17, 2024

Note

The user @kyri-petrou is already attempting to complete issue #8861 and claim the bounty. We recommend checking in on @kyri-petrou's progress, and potentially collaborating, before starting a new solution.

Copy link

algora-pbc bot commented May 23, 2024

@kyri-petrou: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

Copy link

algora-pbc bot commented May 24, 2024

@snigdha510: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

Copy link

algora-pbc bot commented May 31, 2024

The bounty is up for grabs! Everyone is welcome to /attempt #8861 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants