Optimise zio.stream.ZChannel#mapOutZIOPar code#9556
Merged
guizmaii merged 1 commit intoseries/2.xfrom Feb 7, 2025
Merged
Conversation
c2d5245 to
4e1e8b0
Compare
3f48da0 to
577273f
Compare
similar change to those made in this PR #9383
577273f to
c6b8ca4
Compare
hearnadam
reviewed
Feb 7, 2025
| val permits = Semaphore.unsafe.make(n0)(Unsafe) | ||
| val failureRef = Ref.unsafe.make[Cause[OutErr1]](Cause.empty)(Unsafe) | ||
|
|
||
| val setFinalizer: UIO[Unit] = |
Collaborator
There was a problem hiding this comment.
I don't think this needs to be a val. it won't save you any performance.
Member
Author
There was a problem hiding this comment.
It's just to follow the same code pattern used in #9383
I think this val will be inlined at runtime, so yeah, there are no changes in terms of performances. It's esthetic
|
|
||
| permits | ||
| .withPermit( | ||
| latch.succeed(()) *> |
Collaborator
There was a problem hiding this comment.
You can unsafely complete the promise with Exit.unit to avoid an allocation here.
| f(outElem) | ||
| .catchAllCause(cause => | ||
| failureRef.update(_ && cause).unless(cause.isInterruptedOnly) *> | ||
| errorSignal.succeed(()) *> |
guizmaii
added a commit
that referenced
this pull request
Feb 10, 2025
…when possible Idea comes from @hearnadam's review in this PR: #9556
guizmaii
added a commit
that referenced
this pull request
Feb 10, 2025
…when possible Idea comes from @hearnadam's review in this PR: #9556
guizmaii
added a commit
that referenced
this pull request
Feb 10, 2025
…when possible Idea comes from @hearnadam's review in this PR: #9556
guizmaii
added a commit
that referenced
this pull request
Feb 10, 2025
…when possible Idea comes from @hearnadam's review in this PR: #9556
guizmaii
added a commit
that referenced
this pull request
Feb 10, 2025
…when possible Idea comes from @hearnadam's review in this PR: #9556
guizmaii
added a commit
that referenced
this pull request
Feb 10, 2025
…when possible (#9571) * Add internal `Promise#succeedUnit` method to avoid `Exit` allocation when possible Idea comes from @hearnadam's review in this PR: #9556 * fmt * Review: Use `whenZIODiscard` when possible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar changes to those made in this PR #9383
The optimisations are less significant than in #9383 (No
Resulttrick optimisation for example) as the code isn't really more optimisable, I think