Optlevel with submodule

I have a package that creates a submodule. I would like to use the optimization level 1 for everything except the submodule. If I use the code

module MyPackage
   if isdefined(Base, :Experimental) && isdefined(Base.Experimental, Symbol("@optlevel"))
       @eval Base.Experimental.@optlevel 1
   end
   module MySubmodule
   ....
   end
end

Does the optlevel get applied to the submodule MySubmodule? If yes, is there a way to avoid it?

I recall asking this and got the answer that it inherets from the parent module.

2 Likes

You could just manually set the optlevel to 2 again in the submodule.

1 Like