Last active
March 30, 2020 04:03
-
-
Save AStupidBear/df53fcec7287eebec6c2da131711adf4 to your computer and use it in GitHub Desktop.
Compile Plots.jl to shorten first-to-plot time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env julia | |
using Pkg | |
pkg"add PackageCompiler Plots StatsPlots PyPlot" | |
using PackageCompiler | |
snoop = tempname() | |
open(snoop, "w") do fid | |
println(fid, "using Plots") | |
println(fid, "p=plot(rand(5), rand(5))") | |
println(fid, "display(p)") | |
end | |
if get(ENV, "FORCE", "0") == "1" | |
create_sysimage(:Plots, replace_default = true, precompile_execution_file = snoop, cpu_target = "x86_64") | |
else | |
cd(mkpath(expanduser("~/.cache/sysimg"))) | |
create_sysimage(:Plots, sysimage_path = "sys_plots.so", precompile_execution_file = snoop, cpu_target = "x86_64") | |
cd(Sys.BINDIR) | |
str = """ | |
#!/bin/bash | |
julia -J ~/.cache/sysimg/sys_plots.so \"\$@\" | |
""" | |
write("pjulia", str) | |
chmod("pjulia", 0o775) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment