Skip to content

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

@mhauru

Description

@mhauru

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions