Using global variables as in
|
global steps = 200 # discretization levels of probability |
is a
performance trap.
To fix this, I suggest grouping all the global variables into a mutable struct, which you refer to via a const global. See e.g.
https://github.com/JuliaIntervals/IntervalArithmetic.jl/blob/db9202ccd08402d05616442f395e88cb21f79b9b/src/intervals/precision.jl
for a similar design.
Using global variables as in
ProbabilityBoundsAnalysis.jl/src/ProbabilityBoundsAnalysis.jl
Line 70 in 652700c
is a performance trap.
To fix this, I suggest grouping all the global variables into a
mutable struct, which you refer to via aconstglobal. See e.g.https://github.com/JuliaIntervals/IntervalArithmetic.jl/blob/db9202ccd08402d05616442f395e88cb21f79b9b/src/intervals/precision.jl
for a similar design.