Skip to content

Commit 791be6c

Browse files
committed
sysimg/: ReadMe, build script
1 parent 5994749 commit 791be6c

File tree

3 files changed

+42
-23
lines changed

3 files changed

+42
-23
lines changed

sysimg/ReadMe.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
These scripts can be used to generate a custom "system image" with PackageCompiler.jl, like [here](
2+
https://julialang.github.io/PackageCompiler.jl/stable/examples/plots.html).
3+
4+
The goal is to have to wait less long for package imports and first function calls in a
5+
fresh Julia session.
6+
7+
8+
### Build
9+
To build the image, run, in the repo root:
10+
```
11+
julia sysimg/build.jl
12+
```
13+
This takes a few minutes.
14+
15+
16+
### Use
17+
18+
To use the generated system image:
19+
- On the command line:
20+
```
21+
julia --sysimg=sysimg/mysis.dll
22+
```
23+
- As a 'kernel' in Jupyter: [relevant IJulia docs](
24+
https://julialang.github.io/IJulia.jl/stable/manual/installation/#Installing-additional-Julia-kernels)
25+
- Make sure to also add the flag `"--project=@."`.
26+
- For me, the generated kernel definition file is located at:
27+
`C:\Users\tfiers\AppData\Roaming\jupyter\kernels\julia-preloaded-1.7\kernel.json`

sysimg/build.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using PackageCompiler
2+
3+
create_sysimage(
4+
[
5+
:Revise,
6+
:PyCall,
7+
:IJulia,
8+
:PyPlot,
9+
:DataFrames,
10+
:ComponentArrays,
11+
];
12+
sysimage_path = "sysimg/mysys.dll",
13+
precompile_execution_file = "sysimg/to_precompile.jl",
14+
script = "sysimg/pyplot_delay_init.jl",
15+
)

sysimg/to_precompile.jl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,3 @@
1-
# For use with PackageCompiler.jl, to generate a custom "system image", like here:
2-
# https://julialang.github.io/PackageCompiler.jl/stable/examples/plots.html.
3-
#
4-
# The goal is having to wait less long for package imports and first function calls in a
5-
# fresh Julia session.
6-
#
7-
# Commands to run, in the repo root:
8-
#=
9-
using PackageCompiler
10-
pkgs = [:Revise, :PyCall, :IJulia, :PyPlot, :DataFrames, :ComponentArrays]
11-
sysimage_path = "sysimg/mysys.dll"
12-
precompile_execution_file = "sysimg/to_precompile.jl"
13-
script = "sysimg/pyplot_delay_init.jl"
14-
create_sysimage(pkgs; sysimage_path, precompile_execution_file, script)
15-
=#
16-
# To use this system image:
17-
# - On the command line: `julia --sysimg=sysimg/mysis.dll`
18-
# - As a 'kernel' in Jupyter:
19-
# https://julialang.github.io/IJulia.jl/stable/manual/installation/#Installing-additional-Julia-kernels
20-
# Make sure to also add the flag "--project=@.".
21-
# For me, the generated kernel definition file is located at:
22-
# C:\Users\tfiers\AppData\Roaming\jupyter\kernels\julia-preloaded-1.7\kernel.json
23-
241
using PyPlot, DataFrames, ComponentArrays
252

263
df = DataFrame([(a=1, b=2), (a=2, b=2)])

0 commit comments

Comments
 (0)