Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exploding inference time with map(identity, zip(x...)) #37448

Closed
mhauru opened this issue Sep 7, 2020 · 2 comments · Fixed by #37562
Closed

Exploding inference time with map(identity, zip(x...)) #37448

mhauru opened this issue Sep 7, 2020 · 2 comments · Fixed by #37562
Assignees
Labels
compiler:inference Type inference compiler:latency Compiler latency

Comments

@mhauru
Copy link
Contributor

mhauru commented Sep 7, 2020

In:

function main(N)
    t = (nothing, 1)
    arr = fill(t, N)
    map(identity, zip(arr...))
    return nothing
end

for i in 6:9
    println(i)
    @time main(i)
end

Out:

6
  0.264842 seconds (518.52 k allocations: 30.021 MiB, 4.09% gc time)
7
  0.543801 seconds (561.86 k allocations: 31.749 MiB, 1.60% gc time)
8
  2.800034 seconds (681.19 k allocations: 35.867 MiB)
9
 21.998138 seconds (1.10 M allocations: 49.225 MiB, 0.08% gc time)

This happens at least on the latest master and 1.5.

All that time goes into inference, it seems there's a huge stack of recursive calls to typeof_tfunc. More than that I haven't figured out.

@vtjnash
Copy link
Sponsor Member

vtjnash commented Sep 13, 2020

How are you examining the stack of calls? Using @profile, it looks like all calls to typesubtract, due to a complexity problem introduced by cf0c3e0 (#35600)

@mhauru
Copy link
Contributor Author

mhauru commented Sep 15, 2020

I don't know how I ended up thinking typeof_tfunc was the culprit, @profile indeed clearly points at typesubtract. My bad. Thanks for fixing this, although sorry to hear that another issue was resurrected instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference compiler:latency Compiler latency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants