Optimization level when running files with include() in the REPL

I know from the user manual that:

julia -O -- file.jl

has a default optimization level of 3.

I have few questions regarding the optimization level:

If “file.jl” is run in the REPL using:

include("file.jl")
  1. what is the optimization level used?
  2. regarding 1), can this optimization level be changed so that include(“file.jl”) is run with a specified optimization level?

Thanks!

As far as i know, the optimization level is attached to the julia process, not the source file.

If you run julia -O3 file.jl, then all the code in file.jl will be compiled with the -O3 optimization level.

Likewise, if you run julia -O3, and then in the REPL:

include("file.jl")

the code in file.jl will also be compiled with the -O3 optimization level.


I do not know of any way to dynamically or temporarily change the optimization level of a running Julia process / REPL.

1 Like