-
Notifications
You must be signed in to change notification settings - Fork 86
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
Avoid using Scala's Range to reduce allocations #418
Avoid using Scala's Range to reduce allocations #418
Conversation
Hmm... I don't know whether this change really has any positive effect. |
Assuming it does get inlined I would also expect the performance improvement to be fairly minor, but I guess its an improvement nonetheless? There is also a presumption that since this was done in the context of akka-http because it had some impact (either that or it was just really trivial low hanging fruit). Should I write a JMH benchmark to validate both whether it gets fully inlined and also how much performance we are talking about? |
Hmm... I'd certainly be interested in the results of this. |
I will look into this tomorrow as I am also curious about how much impact this will have (and also if it will fully inline or not) |
Co-authored-by: Johannes Rudolph <johannes.rudolph@gmail.com>
9122c21
to
5bb45d5
Compare
I also don't quite understand where this comes from? It wasn't an optimization we did in akka-http... The thing I manually optimized was |
My mistake here if I wasn't clear, I meant that it was done in context of akka-http
Thanks for providing the context, it sounds that the performance improvement in this PR might indeed by useless. I am a bit sick so I didn't have time to create a benchmark but later on I will whip up a quick one just to confirm (but just like you I am quite certain its going to have almost no impact). |
Now I actually understand what @jrudolph was talking about from jrudolph/incubator-pekko-http@67f46c3. I am going to close this PR, if for whatever reason any of us change our mind we can always re-open it. |
This PR is a performance improvement that Pekko (from fork of Akka) did to their internal parboiled2 which is now being upstreamed (for context see apache/pekko-http@58d8f48).
Note that this version has been changed to be more appropriate for upstreaming, i.e. rather than manually inlining the condition (i.e. apache/pekko-http@58d8f48#diff-403c5e6ae1c63f17319929eff0a1f26e3de854a49308f8a7bd2ec707de395ed0L173) instead I have opted to update the constants in
CharPredicate
directly (furthermore I have done the change to allCharPredicate
's). That means the PR performance for this PR also implies thatCharPredicate.from
ends up getting inlined (needs to be verified?)@jrudolph