I have a Julia script which uses several packages and runs several functions from them. This Julia script takes a lot of time every time I run it because every package is precompiled in julia every time I run that script and the time to run the functions is also really high because it runs for the first time every time I call the script. Because of the type of work that I am doing, I necessarily have to run that script from fresh rather then running it in one single session and the time taken in really annoying.
Therefore, I found a nice way to deal with this is creating a sysimage for script which stores everything precompiled to decrease the run time. I followed instructions on Sysimages · PackageCompiler to create a sysimage. But I don’t know how to load that sysimage back into my script. In Sysimages · PackageCompiler, it is discussed on how to start julia with a sysimage but I don’t know how to do the same from a script.
I tried doing it by -
#!/bin/bash
#=
exec julia -J AltroSysimagePrecompile.so --trace-compile=stderr -e 'import Altro' \
"${BASH_SOURCE[0]}" "$@"
=#
module Julia_Functions
#import Pkg; Pkg.activate(@__DIR__); Pkg.instantiate();
using TrajectoryOptimization
using RobotDynamics
using StaticArrays, LinearAlgebra
using Rotations
#using Altro
but it doesn’t seem to work in Linux. Because it still says Altro undefined when I try to call functions from that package. This might be a trivial thing to do but I am new julia and confused on how to go about it. Any help is appreciated.