ProbabilityBoundsAnalysis.jl
ProbabilityBoundsAnalysis.jl copied to clipboard
Store global variables in a `const` structure
Using global variables as in https://github.com/AnderGray/ProbabilityBoundsAnalysis.jl/blob/652700c7d2e1853f189b463d0786fd2f3c467f16/src/ProbabilityBoundsAnalysis.jl#L70 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.
Part of the review for the JuliaCon proceedings: https://github.com/JuliaCon/proceedings-review/issues/96
Thank you for this suggestion. I have followed the example from IntervalArithmetic.jl. In future it would be good to also remove these globals