cmd/compile: inlining callback functions #70260
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
Proposal Details
I'm sorry if this is a duplicate. I honestly tried to find a similar issue
go 1.23
MacOS
I wrote simple generic functions to simplify the work.
Example:
Most of them accept callback functions for various groupings and aggregations.
I compared the performance with the same function, but instead of a callback, it used a method.
I found that the performance of functions with callback is slightly lower than without them.
The reason is that the methods were inline by the compiler, while the callback remained unchanged.
Moreover, the callback is not inline even when the
SeparateIntoTwo
function itself is inline. At this point, the compiler had information about the complexity of the function being passed as an argument.An attempt to inline a callback function by the compiler in cases where the function taking the callback as an argument is also inline
Lack of inlining
The text was updated successfully, but these errors were encountered: