Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jl_egal is an exported and recursively called function which puts some constraints on the optimizer. The way jl_egal is currently structured it pretty much as all the code needed for the comparisons inlined, including the more complex parts to compare tuples and fields. The code goes to great length to optimize special cases which can be treated simpler but the generalization of the rest of the code causes problems. Specifically, the more complex parts of the comparison process require more registers for the optimized code to use. The results in the function starting with a large prologue which saves all the callee-save registers that are used, followed in the end by the respective epilogue. This means that even though in some cases the function will almost immediately return because of the special case handling, all the work for of the prologue and epilogue still has to be done. I ran limited profiling (mostly the arrayops test case) and the jl_egal function shows up on position 3 with 5.48%. With the simple change in this patch this is reduced to 4.64%. The patch is trivial, no real code changes. To prevent the complex prologue/epilogue from unconditionally bing created the complex code blocks are moved into their own functions and then these functions are called. To prevent the optimizer from negating this work the functions must be marked appropriately. Fortunately I've found that this is already done in some cases elsewhere in the code base so I'm sure the change will not create any problem.
- Loading branch information