using Pkg
Pkg.add("Package1")
Pkg.add("Package2")
Pkg.add("Package3")
Option 1: Precompiling packages
One way to make common packages faster to load and use in Julia is by precompiling them. Precompiling a package means that Julia will compile the package’s code ahead of time, so that it doesn’t have to be compiled every time the package is loaded.
using Package1
using Package2
using Package3
By precompiling the packages, the loading time can be significantly reduced, as the compiled code can be directly loaded into memory.
Option 2: Using PackageCompiler.jl
Another option to make common packages faster to load and use is by using the PackageCompiler.jl package. PackageCompiler.jl allows you to create a system image, which is a precompiled version of Julia with specific packages already loaded.
using PackageCompiler
create_sysimage([:Package1, :Package2, :Package3], sysimage_path="my_sysimage.so")
By creating a system image with the common packages, you can start Julia with this system image, and the packages will already be loaded, resulting in faster loading and usage times.
Option 3: Using Revise.jl
Revise.jl is a package that allows you to dynamically update code in Julia without restarting the Julia session. This can be useful when developing packages, as it allows you to make changes to the code and see the results immediately.
using Revise
using Package1
using Package2
using Package3
By using Revise.jl, you can avoid the need to restart Julia every time you make changes to the code of the common packages, resulting in a faster development workflow.
Among the three options, the best option depends on the specific use case. If you are primarily concerned with reducing loading and usage times, precompiling the packages or using a system image with PackageCompiler.jl would be the better options. On the other hand, if you are developing packages and need to make frequent code changes, using Revise.jl would be the more suitable option.