Github user a-roberts commented on the issue: https://github.com/apache/spark/pull/15736 Before progressing I've discussed what I'm seeing with our JIT compiler team, with the refactoring to reduce code duplication, the following occurs which solves some of the mystery -- although it's bad news as, like you, I wanted to remove the duplicate method. Summarising: > By having both of these classes share the getComparator method one level up in the hierarchy, the JIT profiling won't function as expected. > > Let's assume we have A (calling method) -> getComparator -> B (returns the comparator) and then you have C (another calling method) -> getComparator -> D (returns the comparator). > > A and B are the actual methods calling getComparator. B and D are the comparators that are passed in. > > As a JIT compiler if we profile getComparator on its I will see it calling B **and** calling D since profiling in most JITs is context insensitive and we think that's happening here. > > When we inline from A into getComparator and C into getComparator, I don't know if I should inline B or D, and given that inlining is critical for performance we see the slight drop in performance. Inlining is critical for eliminating call overheads, improving code locality, and the scope for optimisation.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org