-
Notifications
You must be signed in to change notification settings - Fork 27
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
More efficient working with headers #289
Conversation
95beca0
to
4cfcb69
Compare
c41793d
to
a61ea20
Compare
@adamw @kciesielski Could you please review and merge this PR? Would you be interested in subsequent improving working with headers and paths (as example replacing regexp and |
@plokhotnyuk Thank you! Performance improvements like this one are much appreciated, and we are definitely interested in subsequent PRs. Unfortunately, the core code has to compile for Scala 2.12 as well. Could you adjust your changes to this requirement? |
@kciesielski Sorry, I had missed to check that I've force pushed an updated commit with fixes that I had tested locally by the following sequence of commands:
|
@plokhotnyuk We use the |
@kciesielski Thanks, for the heads up! Now |
Awesome, thanks again! |
} | ||
} | ||
private def processString(str: String): List[WeightedEncoding] = | ||
str.trim.split(",").map(x => parsSingleEncoding(x.trim)).reverse.toList // TODO: do we really need `.reverse` here? |
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.
regarding the TODO - yeah it looks weird, why would we need to reverse; if anything, we want to preserve the original ordering?
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.
Originally reversing was introduced by recursive version of previous implementation.
So my question in the TODO message was about need of reversion for the result list.
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.
There was another tail-recursion with an accumulator which reversed the list - I moved the reverse
to the more logical place: ea43d96
Thanks for the PR, btw :)
Currently, it is quite expensive in terms of burned CPU and eaten memory bandwidth during parsing, validation


...and serialization
This PR reduces that overheads and improves working with headers.