Skip to content

Inlining cost model needs work #29798

@timholy

Description

@timholy

#29796 contains a couple of manual @inlines that shouldn't be necessary. Analysis of length(::String, ::Int, ::Int) indicates that:

  • exception paths (or rather, just invokes to throw) account for a total cost of 140. This would be fixed by implementing a real version of Inlining statement cost: don't penalize call-Exprs that throw #23986 (a high priority of mine when I find the time)
  • 5 foreigncalls are to jl_value_ptr which gets specially handled by the compiler and thus shouldn't pay a cost of 20 units. I've not yet calculated what the right cost is, but this could save up to 100 units of the budget

Optimistically this would shave the cost of that function down to 135 units. This is still above our current threshold of 100 for inlining, so either (1) this might need further work or (2) we should raise the threshold for inlining. (The performance improvements in #29796 are quite dramatic and clear evidence that we are not doing the right thing currently.)

Metadata

Metadata

Assignees

Labels

compiler:optimizerOptimization passes (mostly in base/compiler/ssair/)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions