JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.47k stars 187 forks source link

notable startup latency #1052

Closed thautwarm closed 8 months ago

thautwarm commented 1 year ago

It seems that the latency gets worse with newer Julia. Here are the startup tests on my local machine:

Julia v1.9.2:

julia> @time using PyCall
  0.427297 seconds (250.30 k allocations: 18.071 MiB, 1.88% compilation time)

julia> @time using PyCall
  1.162834 seconds (1.32 M allocations: 91.732 MiB, 5.27% gc time, 99.92% compilation time: 100% of which was recompilation)

Julia v1.7.3:

julia> @time using PyCall
  0.689246 seconds (1.16 M allocations: 81.998 MiB, 1.08% gc time, 42.07% compilation time)

julia> @time using PyCall
  0.630776 seconds (1.98 M allocations: 104.340 MiB, 2.96% gc time, 99.86% compilation time)

Julia v1.9 is quite slow at loading PyCall comparing to it used to be in v1.7. I wonder if there are any known reasons for the latency or possible approaches to address this?

MilesCranmer commented 8 months ago

Hey @thautwarm, I was wondering if this is still an issue on v1.10 with https://github.com/JuliaLang/julia/pull/49525 merged?

I see this locally on 1.10.0:

julia> @time using PyCall
  0.311416 seconds (367.73 k allocations: 24.860 MiB, 3.42% gc time, 66.53% compilation time: 98% of which was recompilation)

julia> @time using PyCall
  0.000159 seconds (151 allocations: 13.984 KiB)

Cheers, Miles

thautwarm commented 8 months ago

It gets resolved since 1.10, but still applicable for earlier versions.

stevengj commented 8 months ago

Closing as a Julia issue that is now fixed.