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

much slower than terminal #1005

Closed
XinyuWuu opened this issue Apr 30, 2021 · 4 comments
Closed

much slower than terminal #1005

XinyuWuu opened this issue Apr 30, 2021 · 4 comments

Comments

@XinyuWuu
Copy link

When I use IJulia with a costom sysimage created by PackageCompiler.jl, the code runs much slower.

my kernel:

{
  "display_name": "Julia costom sysimage 1.6.1",
  "argv": [
    "/home/wuxinyu/Programs/julia/bin/julia",
    "-i",
    "--color=yes",
    "--sysimage=/home/wuxinyu/.julia/environments/v1.6/mysys.so",
    "/home/wuxinyu/.julia/packages/IJulia/e8kqU/src/kernel.jl",
    "{connection_file}"
  ],
  "language": "julia",
  "env": {},
  "interrupt_mode": "signal"
}

my test code:

using Gadfly, RDatasets
set_default_plot_size(21cm, 8cm)

p1 = plot(dataset("HistData","DrinksWages"), x="Wage", y="Drinks",
    shape=[Shape.square], Scale.y_log10)

aww, mws = dataset("MASS", "Animals"), dataset("quantreg", "Mammals")
p2 = plot( layer(aww, x=:Body, y=:Brain, shape=["Brain weight"]),
    layer(mws, x=:Weight, y=:Speed, shape=["Run speed"]),
    Scale.x_log10, Scale.y_log10, Guide.xlabel("Body weight"),
    Guide.ylabel("Brain weight and Run speed"),
    Theme(point_shapes=[Shape.circle, Shape.star1], alphas=[0.0],
        discrete_highlight_color=identity) )
hstack(p1, p2)

When in the terminal it runs extremely fast, but in the notebook, it takes 12s. In both case the code is the first time been executed.

@twavv
Copy link
Contributor

twavv commented Apr 30, 2021

This is just a guess, but could it be that using IJulia causes precompilation invalidations? Did you build the sysimage with IJulia? (If not, does building with IJulia included fix the issue?)

@XinyuWuu
Copy link
Author

XinyuWuu commented May 1, 2021

PackageCompiler.create_sysimage([:Gadfly,:DataFrames,:Colors,:Dates,:OhMyREPL,:ColorSchemes,:Distributions,:RDatasets,:Compose,:Random,:CSV,:GLPK,:HDF5,:IterTools,:JSON,:JuMP,:Measures,:RData,:XLSX,:Printf,:Statistics,:CategoricalArrays,:IJulia], precompile_statements_file="compiler_trace.jl",sysimage_path="mysys.so")

It is my build command. I have include the IJulia, but it is still much slower. And I have test not only one piece of code, but more ploting code, so I don't think it is a guess.

IJulia did not causes precompilation invalidations, it runs faster than before(without precompiled sysimage), but it is much slower than terminal.

I think IJulia definitely slow down the speed in some way, but I don't know the reasons.

@terasakisatoshi
Copy link

I think you also need precompile display function that is used by IJulia.
My repository https://github.com/terasakisatoshi/sysimage_creator will help you.
It will reduce time to initialize Jupyter Kernel and plot for the first time. Have a try.

@nilshg
Copy link

nilshg commented Sep 26, 2024

This can be closed.

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

No branches or pull requests

4 participants