-
Notifications
You must be signed in to change notification settings - Fork 157
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
perf: Drop the usages of SupervisedGraphStageLogic to reduce allocation. #864
Conversation
I have reviewed some of your PRs, but due to my lack of familiarity with the project, I did not comment. But I noticed that there is a '=str' in the title all of them, and I don't quite understand what it means. |
=means I added no api change, and str is abbr for stream module. BTW, I see you from China, are you in the wechat group ? |
Im with @pjfanning here, I would rather drop this convention (i.e. For me, simple git commit messages with active tense as well as making sure commits are atomic as possible is whats most important, i.e. general guidelines as from https://reflectoring.io/meaningful-commit-messages/ |
Is this a legitimate issue, I mean we can do behavioural changes if its well justified? |
I think we can't, if I change to make use of OptionVal, then it will just ignore the value and do nothing, which was a Some(null) and throw an NPE. and I will update the commit message then.eg perf:xxx |
6ce93e0
to
6d7c5f3
Compare
yeah, I am in Hangzhou,Zhejiang, and I am newcommner for pekko/akka,I plan to introduce Pekko into my project in future. |
@laglangyue Are you using Pekko at work too, welcome and you are welcome to review this PR too. |
I don't have a deep understanding of akka/pekko, so I can't comment on this PR.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first thought is that this is a trade-off between abstraction and performance.
Too much duplicate code is not good to maintenance and code readability.
Considering that other Operators (such as Fold) in Ops also use inline instead of SupervisedGraphStageLogic
, I will not be too picky about the duplicate code brought by this PR.
stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala
Outdated
Show resolved
Hide resolved
Thank you both from China Scala community to review this, I was plan to add onErrorReturn and OnErrorResume and OnErrorComplete operators, which need very handy control around the supervision. |
6d7c5f3
to
9370504
Compare
@mdedetrich @pjfanning ping~ |
I wouldn't be surprised if the inliner (i.e. #857) will automatically do some of these performance improvements, unfortunately it would only work for Scala 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Motivation:
There is a allocation of
Some
inSupervisedGraphStageLogic
and for performance reason, I want to remove that.I can choose the
Option[T]
toOptionVal[T]
, but that will cause the problem if the user specified function returnnull
.So I choose to drop the usage of
SupervisedGraphStageLogic
.Result:
Reduce allocation, but repeated code.
Status: Mima file is not added yet, open for discussion, and I think should remove the
SupervisedGraphStageLogic
too.