Skip to content

performance regression in findfirst due to inlining #26446

Closed
@JeffBezanson

Description

julia> a = rand(10000000); z = a[end];

julia> @time findfirst(equalto(z), a)
  0.411288 seconds (10.01 M allocations: 153.062 MiB, 36.84% gc time)

In 0.6 there are no allocations. The reason for this is that findfirst is a simple wrapper for findnext, and so it does not get specialized on its function argument (since it doesn't call the function itself). However, findnext is being inlined into it anyway. I don't think we should inline in this case (perhaps whenever the argument types are not is_cacheable_sig for the target method, and/or because the target method has a loop).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    compiler:optimizerOptimization passes (mostly in base/compiler/ssair/)performanceMust go fasterregressionRegression in behavior compared to a previous version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions