Now nothing beats option E with @inbounds
@benchmark optA(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 18.172 ms (0.00% GC)
# median time: 20.093 ms (0.00% GC)
# mean time: 20.238 ms (0.00% GC)
# maximum time: 24.194 ms (0.00% GC)
# --------------
# samples: 248
# evals/sample: 1
@benchmark optAib(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 20.944 ms (0.00% GC)
# median time: 21.362 ms (0.00% GC)
# mean time: 21.542 ms (0.00% GC)
# maximum time: 24.136 ms (0.00% GC)
# --------------
# samples: 233
# evals/sample: 1
@benchmark optB(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 4.528 ms (0.00% GC)
# median time: 5.371 ms (0.00% GC)
# mean time: 5.395 ms (0.00% GC)
# maximum time: 8.741 ms (0.00% GC)
# --------------
# samples: 927
# evals/sample: 1
@benchmark optBib(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 3.606 ms (0.00% GC)
# median time: 3.724 ms (0.00% GC)
# mean time: 3.789 ms (0.00% GC)
# maximum time: 5.126 ms (0.00% GC)
# --------------
# samples: 1320
# evals/sample: 1
@benchmark optC(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 12.782 ms (0.00% GC)
# median time: 13.540 ms (0.00% GC)
# mean time: 13.619 ms (0.00% GC)
# maximum time: 16.399 ms (0.00% GC)
# --------------
# samples: 368
# evals/sample: 1
@benchmark optCib(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 2.949 ms (0.00% GC)
# median time: 3.240 ms (0.00% GC)
# mean time: 3.322 ms (0.00% GC)
# maximum time: 6.005 ms (0.00% GC)
# --------------
# samples: 1505
# evals/sample: 1
@benchmark optD(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 11.209 ms (0.00% GC)
# median time: 11.960 ms (0.00% GC)
# mean time: 12.088 ms (0.00% GC)
# maximum time: 18.776 ms (0.00% GC)
# --------------
# samples: 414
# evals/sample: 1
@benchmark optDib(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 2.452 ms (0.00% GC)
# median time: 2.898 ms (0.00% GC)
# mean time: 2.919 ms (0.00% GC)
# maximum time: 4.484 ms (0.00% GC)
# --------------
# samples: 1713
# evals/sample: 1
@benchmark optE(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 4.383 ms (0.00% GC)
# median time: 4.899 ms (0.00% GC)
# mean time: 4.963 ms (0.00% GC)
# maximum time: 7.618 ms (0.00% GC)
# --------------
# samples: 1008
# evals/sample: 1
@benchmark optEib(A)
# BenchmarkTools.Trial:
# memory estimate: 0 bytes
# allocs estimate: 0
# --------------
# minimum time: 2.374 ms (0.00% GC)
# median time: 2.434 ms (0.00% GC)
# mean time: 2.515 ms (0.00% GC)
# maximum time: 4.093 ms (0.00% GC)
# --------------
# samples: 1987
# evals/sample: 1
At the risk of a digression, is there a way to activate/deactivate bounds checking as a startup option for Julia? I’m thinking that I would want bounds checking when actively coding, but deactivating it for running the .jl file, without having to manually use @inbounds
in all the loops. Or, use @inbounds
in all the loops, but having an option at startup to ignore that.