This is an old thread, but I’m pleased to report new information. On an up-to-the moment copy of Julia 0.7 (you need https://github.com/JuliaLang/julia/pull/24899 and a few others, also the new optimizer probably helps) and Introduce full support for array operations by timholy · Pull Request #52 · JuliaArrays/OffsetArrays.jl · GitHub, the performance gap (on my machine) is no longer present. Indeed, for reasons I don’t fully understand the OffsetArray version seems consistently a bit faster:
julia> @btime lap2o($ox,$oy)
2.365 ms (0 allocations: 0 bytes)
julia> @btime lap2($x,$y)
2.588 ms (0 allocations: 0 bytes)
julia> @btime lap2o($ox,$oy)
2.372 ms (0 allocations: 0 bytes)
julia> @btime lap2($x,$y)
2.593 ms (0 allocations: 0 bytes)