Speedup OpamVersionCompare by 25% - #5518
Conversation
| (* splits a version into (epoch,rest), without the separating ':'. The | ||
| * epoch is delimited by the leftmost occurrence of ':' in x, and is "" | ||
| * in case there is no ':' in x. *) | ||
| let extract_epoch x = |
There was a problem hiding this comment.
Note for reviewers: This was removed because OpamPackage.Version.of_string never allowed :. This is only an unused remnant of the Dose3 implementation.
There was a problem hiding this comment.
That's good to know - getting rid of the remaining allocs should be a lot easier if we don't need to support epochs!
5e1b91b to
ac8d472
Compare
|
Crap, my testing method for The speedup for OpamVersionCompare is still present but it's not as significant for real-life commands sadly :( |
ac8d472 to
7bbd13b
Compare
7bbd13b to
71d09d0
Compare
c9546a9 to
e7587ed
Compare
|
The latest benchmark shows a 18% speedup, in line with the local tests. I believe this is ready to go. |
f30871b to
7760468
Compare
|
After #6144 the PR now improves performance by 28% |
rjbou
left a comment
There was a problem hiding this comment.
On the idea and the code itself, lgtm!
I'm wondering if we should update the header as now we are changing that piece of code. Previous version is still the same code that the one in dose (modulo formatting).
Also, can you update the main comment to highlight the change you made, the origin of the speedup.
7760468 to
510e56c
Compare
Doing so does, for example, speeds-up typicalopam show <pkg>by 50%I also tried a completely new implementation of
OpamPackage.Version.comparethat would have sped-up the comparison function by 30% instead but doing so madeOpamPackage.Version.of_stringslower, as i was actually parsing the string first and pre-processed it so the comparison function is faster, but it wasn't worth it in the end.F.i.x.e.s. #5479 as it speeds-up switch loading time from 0.22s to 0.044s on my M1Pro.Related to #4245 (cc @emillon)
Requires #6078