IRTools.jl icon indicating copy to clipboard operation
IRTools.jl copied to clipboard

@nospecialize slows down first time inference

Open Roger-luo opened this issue 5 years ago • 1 comments

I notice the use of @nospecialize slows down the first time inference when using IRTools functions (e.g Pipe, update!) a lot, not sure why

# without nospecialize
6.351286 seconds (10.75 M allocations: 572.988 MiB, 5.41% gc time)
# with nospecialize
7.406211 seconds (14.54 M allocations: 773.888 MiB, 5.02% gc time)

I suspect this is also causing other things (like Zygote) to be extremely slow for the first run.

Roger-luo avatar Jun 07 '20 08:06 Roger-luo

You could reproduce this via this branch: https://github.com/QuantumBFS/YaoLang.jl/pull/25

using

julia --project precompile.jl

in the project folder

Roger-luo avatar Jun 07 '20 08:06 Roger-luo