Skip to content

Commit 329d1a9

Browse files
committed
Force-inline offset
This led to a 50x performance improvement in one algorithm!
1 parent 174fc7a commit 329d1a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/OffsetArrays.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Base.fill(x, inds::Tuple{UnitRange,Vararg{UnitRange}}) =
125125
### Low-level utilities ###
126126

127127
# Computing a shifted index (subtracting the offset)
128-
offset{N}(offsets::NTuple{N,Int}, inds::NTuple{N,Int}) = _offset((), offsets, inds)
128+
@inline offset{N}(offsets::NTuple{N,Int}, inds::NTuple{N,Int}) = _offset((), offsets, inds)
129129
_offset(out, ::Tuple{}, ::Tuple{}) = out
130130
@inline _offset(out, offsets, inds) =
131131
_offset((out..., inds[1]-offsets[1]), Base.tail(offsets), Base.tail(inds))

0 commit comments

Comments
 (0)