-
Notifications
You must be signed in to change notification settings - Fork 250
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
Time to first plot in Gadfly is very slow even after Gadfly has been precompiled. #921
Comments
Could you share the results of profiling Gadfly? I think this is a high priority issue since the time till first plot is excessive. |
I haven't run the profiler on it. Based on the timings, my understanding is that we need to more aggressively precompile |
I tried adding
to |
Calling I suspect that much of the time is spent in compose.jl and perhaps other dependencies, but we may be able to add similar calls to those as well. |
Ah. Adding
which is interesting |
Make sure to instantiate the mime type. There's a neater string macro as Anyway if there's no difference that points to the compiler time being in On Mon, 17 Oct 2016, 19:07 Tamas Nagy, notifications@github.com wrote:
|
I've been tracing the stringmime calls, and it ends up in line 971 in Gadfly.jl, which then moves on to compose. The following calls in Compose's precompile might be useful:
What I don't know is what PS: @tlnagy, for the record, you second call should be |
I had carried out some of these experiments before and reached the same conclusions. FWIW, we used to have much faster plots on juliabox with julia 0.3, when Gadfly was built into the Julia system image. |
Ah yeah, thanks.
The key might be in there somewhere.
It must be something with how precompilation is wired up across Gadfly and Compose because once the first plot is generated, it's pretty quick. |
The old precompile.jl scripts were generated with SnoopCompile, but they might need updating if the internal architecture of Gadfly/Compose has changed. That said, it still can't do everything because:
Only the For folks who dislike the overhead that precompile files add to recompiling Gadfly, don't forget about julia's |
I think I managed to track down the problem back when looking in #921. It was never the rendering in Compose or Gadfly that was slow, it was always the moment it had to actually generate plot and get the browser to open it. |
precompilation across module boundaries seems like a generally useful thing, and a good solution for Gadfly's first-time-to-plot latency. would that be hard to implement? |
I haven't really looked. I suspect the crucial code is Julia's |
Cc @vtjnash |
I don't, that's just a hunch. These are the only two limitations of precompilation that I know about. |
OK, with this gist I can demonstrate a small penalty due to having multiple modules: julia> include("twocalls.jl")
testscript (generic function with 1 method)
julia> onemodule(10^3)
julia> twomodules(10^3)
julia> testscript("/tmp/runtests.jl", 10^3) Now go to julia> push!(LOAD_PATH, pwd())
3-element Array{String,1}:
"/home/tim/src/julia-0.5/usr/local/share/julia/site/v0.5"
"/home/tim/src/julia-0.5/usr/share/julia/site/v0.5"
"/tmp"
julia> using A
INFO: Recompiling stale cache file /home/tim/.julia/lib/v0.5/A.ji for module A.
julia> include("runtests.jl")
runfoo (generic function with 1 method)
julia> @time runfoo()
2.529762 seconds (316.71 k allocations: 13.272 MB, 0.40% gc time)
336342000 Restart julia and do it again, but this time with julia> @time runfoo()
2.976062 seconds (971.97 k allocations: 45.177 MB, 0.73% gc time)
336342000 Not a huge difference, but it's something. A number of issues filed against Julia have demonstrated that some functions have much longer inference time than others, so one shouldn't take this ratio as being a universal truth. For Gadfly, the best thing would be to profile the time to |
Is there a way to use the Julia static ahead of time (AOT) compilation feature to blitz the long first plot delay? Or even better, to make it possible to debug Julia code with lldb?
|
i can't make sense of
what i really don't understand is why
|
This is very old, but isn't the issue here that the types being provided in the tuple are not concrete? The Dict needs parameters and Any is not concrete. Something like the following would work. I'm also sensing the need for a
|
Gadfly precompilation even though slow, is a one time thing - and after that
using Gadfly
is fast. However, even then, the first plot in a clean Julia session typically takes 20-30 seconds.It seems that the time is all spent in compiling
stringmime("text/html", plot(...))
that prepares all the rendering. From the second time onwards, this all takes a split second.Is there any way to add
precompile
hints forstringmime
to improve the time for the first plot?The text was updated successfully, but these errors were encountered: