Yes, that’s precisely what PackageCompiler will do. Even better, it can give you a relocatable bundle that includes all artifacts and dependencies and Julia itself with a single point of entry.
Were I putting together something to ship, I’d do it as a package. Note that packages have facilities to do even more precompilation than the default. If I really needed to cut down on startup time, I’d use PackageCompiler. Both of those are great as they will automatically install/bundle dependencies.
If you really want to stick to a script paradigm, you could look into using @nospecialize
or Base.Experimental.@optlevel 0
(on 1.5) to do more finely tuned versions of --compile=min
and -O0
that get included as a part of your script.
I should emphasize that lots of work has gone into improving this latency on 1.5 and it’s continuing to improve.