Skip to content

Instantly share code, notes, and snippets.

@terasakisatoshi
Last active October 29, 2021 00:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terasakisatoshi/0fe5777996598dd654df81ec9770c0e3 to your computer and use it in GitHub Desktop.
Save terasakisatoshi/0fe5777996598dd654df81ec9770c0e3 to your computer and use it in GitHub Desktop.
For those who want to improve first call latency via PackageCompiler.jl
using PackageCompiler
PackageCompiler.create_sysimage(
[:Atom,:Juno,:Plots], # you may add OhMyREPL, Revise and so on
precompile_statements_file=["traced.jl"],
precompile_execution_file=["execution.jl"],
sysimage_path="atom.dylib",
)
# write something you want to improve first call latency
using Plots
p1=plot(sin)
p1|>display
p2=plot!(p1, cos)
p=plot(rand(10), rand(10))
p|>display
@terasakisatoshi
Copy link
Author

terasakisatoshi commented Apr 18, 2020

How to use

Build system image

  • Download execution.jl and build.jl
  • Simply run the following commands:
$ julia --trace-compile=traced.jl -e 'using Pkg, Atom, Juno; Pkg.test("Atom"),Pkg.test("Juno")'
$ julia build.jl
  • It will create a system image named atom.dylib (See build.jl which includes sysimage_path="atom.dylib"). Please modify extension dylib as you wish (I'm using macOS).

Open Atom

Go to Settings of Julia client

  1. Open preference of Atom (Cmd + , or Ctrl +, ). Then, go to Packages -> Settings( of julia-client) -> Click Julia Options
    . You'll find Additional Julia Startup Arguments.
    image

  2. Set value -J/path/to/atom.dylib to Additional Julia Startup Arguments. See the following image.

image

  1. Restart Atom and then initialize REPL of Juno. That's all.

Result

Before

image

After

You'll find it will improve loading time of Plots.jl Enjoy.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment