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

Loading CSV makes tab completion in the REPL extremely slow #34098

Closed
KristofferC opened this issue Dec 13, 2019 · 14 comments · Fixed by #34596
Closed

Loading CSV makes tab completion in the REPL extremely slow #34098

KristofferC opened this issue Dec 13, 2019 · 14 comments · Fixed by #34596
Labels
compiler:latency Compiler latency
Milestone

Comments

@KristofferC
Copy link
Member

KristofferC commented Dec 13, 2019

Doing using CSV and then foo("<TAB in the REPL makes the REPL lag for ~10 seconds. Running with --trace-compile and timing the different precompile statement there is one that takes 10(!) seconds to run. MWE is:

julia> using CSV; using REPL; @time precompile(Tuple{typeof(REPL.REPLCompletions.completions), String, Int64})
 10.879856 seconds (25.56 M allocations: 1.508 GiB, 3.41% gc time)

Entering the Pkg REPL also takes like 20 seconds after using CSV.

@KristofferC KristofferC added the compiler:latency Compiler latency label Dec 13, 2019
@laborg
Copy link
Contributor

laborg commented Dec 14, 2019

See also: JuliaData/CSV.jl#537

@KristofferC
Copy link
Member Author

KristofferC commented Dec 14, 2019

Weird, on my 1.3.1 backport branch built locally it only takes 0.4 seconds... But downloading the binary from the buildbot with the same commit, it takes 30 seconds!

@KristofferC
Copy link
Member Author

Ok, Jameson helped me figured that one out. The binary from the buildbot has asserts on so it is slower (significantly so in this particular case).

@KristofferC
Copy link
Member Author

Ok, this seems fixed on 1.3.1 and master so I guess good to close 🤷‍♂ .

@evanfields
Copy link

@KristofferC I'm still seeing this behavior on 1.3.1 (macOS). Is this just an inevitable consequence of asserts always being enabled?

@KristofferC
Copy link
Member Author

I'll try it again

@KristofferC KristofferC reopened this Jan 1, 2020
@KristofferC
Copy link
Member Author

Yes, this does indeed happen on 1.3.1 release. Strange, maybe julia asserts are accidentally enabled for releases(!)?

@KristofferC
Copy link
Member Author

And now it seems to happen when building 1.3.1 locally as well so maybe it isn't about asserts. I have no idea what is going on, would be good for someone else to do some testing, perhaps I am just crazy.

@KristofferC
Copy link
Member Author

Still happens in 1.4 RC1.

julia> using CSV; using REPL; @time precompile(Tuple{typeof(REPL.REPLCompletions.completions), String, Int64})
 49.933756 seconds (33.86 M allocations: 2.063 GiB, 2.78% gc time)
true

(different machine so numbers not directly comparable).

@timholy
Copy link
Member

timholy commented Jan 25, 2020

Possibly related: https://discourse.julialang.org/t/slowdown-after-package-load/33533

The weirdest part is that using MCMCChains on its own causes the problem, but if I first load all of MCMCChain's dependencies:

julia> using AbstractMCMC, AxisArrays, DataFrames, Distributions, KernelDensity, LinearAlgebra, Random, RecipesBase, Serialization, Showoff, SpecialFunctions, Statistics, StatsBase

julia> using MCMCChains

then it's fine.

@KristofferC
Copy link
Member Author

Yeah, I have also noticed differences depending on order of package loads. The weird thing here is that I had julia builds when the case here didn't exist at all so there seems to be some pathological case that causes this to happen.

@KristofferC
Copy link
Member Author

KristofferC commented Jan 25, 2020

Some kind of lead? JuliaData/CSV.jl#537 (comment)

Can anyone confirm that commenting out this join method:
https://github.com/JuliaData/DataFrames.jl/blob/e8e5cb5f40fbafa46927c19c00270f6ea3caff74/src/abstractdataframe/join.jl#L309-L431
makes the problem pretty much go away?

In addition, the same is true for the join in FilePathsBase (commenting out the AbstractString argument type in the splatted argument also seems to fix it):
https://github.com/rofinn/FilePathsBase.jl/blob/37ce645ca40de031ac7fd7f05274bfdd1f1edd69/src/path.jl#L230-L242

So it seems that the join methods are interacting with eachother?

@JeffBezanson JeffBezanson added this to the 1.4 milestone Jan 29, 2020
@JeffBezanson
Copy link
Member

This is really fragile. For example adding the commit from #34473 "fixes" it, but it's very unclear why. All the time is in inference.

Just for fun, #34339 speeds this up by ~8%, so it seems to help a bit more in pathological cases than in the average case.

@robsmith11
Copy link
Contributor

For me with the latest nightly, this is fixed on my Skylake Xeon, but on an AArch64 tablet, I'm still seeing a >1 minute delay for the first tab completion after loading CSV.jl. Same versions of Julia and packages on both systems.

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

Successfully merging a pull request may close this issue.

6 participants