Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@guizmaii
Copy link
Member

@guizmaii guizmaii commented Jan 13, 2026

(Merged in: #10378)

@guizmaii guizmaii self-assigned this Jan 13, 2026
@guizmaii guizmaii force-pushed the opt_Semaphore_0 branch 5 times, most recently from 68824af to 76c5cce Compare January 13, 2026 01:55
ZIO.suspendSucceed {
val promises = ref.unsafe.modify(loop(n, _, Nil))
if (promises.isEmpty) Exit.unit
else ZIO.foreachDiscard(promises)(_.succeedUnit)
Copy link
Member Author

Choose a reason for hiding this comment

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

Prefering the execute all the promise.succeedUnit calls with a ZIO.foreachDiscard instead of a chain of FlatMap

@guizmaii guizmaii marked this pull request as ready for review January 13, 2026 09:09
@guizmaii guizmaii merged commit ae05da8 into opt_Semaphore Jan 14, 2026
3 of 17 checks passed
@guizmaii guizmaii deleted the opt_Semaphore_0 branch January 14, 2026 04:14
guizmaii added a commit that referenced this pull request Jan 14, 2026
…10382)

* Optimise `Semaphore`: Use an optimised data structure to queue jobs

* Optimise `releaseN` loop

* fmt

* Add test

* Clean tests

* Add more tests

* fmt

* Optimise `Semaphore`: Remove allocation of `Promise` when not needed (#10383)
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