perf: improve release validation performance#279
Conversation
Avoid expensive calls to look for conflicts when the prefixes do not match.
|
The comment is not posted, I have downloaded the numbers from the CI artifacts: So a 3x improvement. |
| } else { | ||
| break |
There was a problem hiding this comment.
I cannot confidently tell if this is changing anything. Is that to speed things up by skipping remaining slices in newSlices?
There was a problem hiding this comment.
Yes, once GlobDistance fails we can skip the rest of the loop. This obviously does not have a very big impact, compared to the other change, but it was a low hanging fruit for a 1 line change so I decided to add it.
There was a problem hiding this comment.
Ok, thanks! Maybe the comment could mention why this is fine to stop the rest of the loop?
There was a problem hiding this comment.
I did and I added a TODO comment saying that the loops can be reordered. I didn't do it in these patches because:
- It did not have a measurable impact.
- It made the diff much bigger and harder to review.
Let me know what you think.
There was a problem hiding this comment.
It is much clearer, thanks!
Co-authored-by: Upils <5464641+upils@users.noreply.github.com>
Co-authored-by: Upils <5464641+upils@users.noreply.github.com>
upils
left a comment
There was a problem hiding this comment.
Thanks. There is only a minor typo in a comment, but nothing blocking.
Co-authored-by: Upils <5464641+upils@users.noreply.github.com>
niemeyer
left a comment
There was a problem hiding this comment.
Please save this PR for later. This is not the time to fiddle with this complex and non-trivial algorithm, even more if the gains are marginal. From the last conversation on this, we want to improve the performance of the application as a whole by orders of magnitude, so if that's doing it, please let me know, otherwise let's keep talking.
|
Sorry, I spoke too quickly.. I now see your follow up report above that this does improve by 3x, which is significant. Let's please look at this during or after the sprint. |
Avoid expensive calls to look for conflicts when the prefixes do not
match.
I tried many performance improvements and rewrites of the logic below. This are the only ones that move the needle significantly. With big rewrites of the algorithm I am able to get a ~6% more, so in my opinion it is not worth going that route of extra complexity and longer reviews; we should look for performance improvements elsewhere. I also tried many other tricks like finding the end index by using binary search as well, being more clever about the prefix, etc. and none of them increased performance more than 2/3% compared to this PR, so again they were not included as they made the code more complex.