I think that would be how a regular person writes code and the code looks perfectly logical… The mental model is to take all the differences and then find the max out of the results. We can say that this mental model isn’t efficient but that’s how one generally thinks about solving the problem (not necessarily making it fast). It would be really really cool if compiler technology can do that kind of optimization automatically. (I’m greedy
)
I use the standard distribution for MacOS. Just tried -O3 but I don’t see an noticeable difference.
$ julia RBC.jl
2018-02-11T18:24:16.799
2018-02-11T18:24:32.894
1.6095
$ julia -O3 RBC.jl
2018-02-11T18:24:42.516
2018-02-11T18:24:59.266
1.675
$ echo "versioninfo()" | julia
Julia Version 0.6.2
Commit d386e40c17 (2017-12-13 18:08 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin14.5.0)
CPU: Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, haswell)