-
Notifications
You must be signed in to change notification settings - Fork 347
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
Speedup OpamVersionCompare by 15% #5518
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!
Doing so does, for example, speeds-up typical `opam show <pkg>` by 50%
… new implementation of OpamVersionCompare
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
Doing so does, for example, speeds-up typicalopam show <pkg>
by 50%I also tried a completely new implementation of
OpamPackage.Version.compare
that would have sped-up the comparison function by 30% instead but doing so madeOpamPackage.Version.of_string
slower, 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)