Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Prevent integer width conversion in caml_int_compare #2250
Does this change improves performance in a measurable way? int32 -> int64 conversions are extremely cheap, and the proposed code is less readable than the current code... I'm not asking for big speedups, just a hint that it makes a non-negligible difference.
I've updated the code to use a macro, and changed all the other comparisons that had this issue.
Benchmark results on a loop that adds up the results of comparisons:
This is the program:
The difference in the two functions is clear when you look at the disassembly.
With this patch: