Skip to content

Commit ededaab

Browse files
committed
Add some inline annotations for performance
1 parent 678b4a2 commit ededaab

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Interpolations.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ end
246246
# interp_getindex1(A, indexes::Tuple{}, weights::Tuple{}, rest, I::Vararg{Int,M}) where M =
247247
# error("exhausted the weights and indexes, this should never happen")
248248

249-
interp_getindex(A::AbstractArray{T,N}, J::Tuple{Int,Vararg{Any,K}}, I::Vararg{Int,N}) where {T,N,K} =
249+
@inline interp_getindex(A::AbstractArray{T,N}, J::Tuple{Int,Vararg{Any,K}}, I::Vararg{Int,N}) where {T,N,K} =
250250
interp_getindex(A, Base.tail(J), Base.tail(I)..., J[1])
251251
@generated function interp_getindex(A::AbstractArray{T,N}, J::Tuple{WeightedAdjIndex{L,W},Vararg{Any,K}}, I::Vararg{Int,N}) where {T,N,K,L,W}
252252
ex = :(w[1]*interp_getindex(A, Jtail, Itail..., j))
@@ -274,7 +274,7 @@ end
274274
$ex
275275
end
276276
end
277-
interp_getindex(A::AbstractArray{T,N}, ::Tuple{}, I::Vararg{Int,N}) where {T,N} = # termination
277+
@inline interp_getindex(A::AbstractArray{T,N}, ::Tuple{}, I::Vararg{Int,N}) where {T,N} = # termination
278278
@inbounds A[I...] # all bounds-checks have already happened
279279

280280
"""

src/b-splines/indexing.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ end
5959
end
6060

6161

62-
function weightedindexes(fs::F, itpflags::NTuple{N,Flag}, knots::NTuple{N,AbstractVector}, xs::NTuple{N,Number}) where {F,N}
62+
@inline function weightedindexes(fs::F, itpflags::NTuple{N,Flag}, knots::NTuple{N,AbstractVector}, xs::NTuple{N,Number}) where {F,N}
6363
parts = map((flag, knotvec, x)->weightedindex_parts(fs, flag, knotvec, x), itpflags, knots, xs)
6464
weightedindexes(parts...)
6565
end
@@ -68,7 +68,7 @@ weightedindexes(i::Vararg{Int,N}) where N = i # the all-NoInterp case
6868

6969
const PositionCoefs{P,C} = NamedTuple{(:position,:coefs),Tuple{P,C}}
7070
const ValueParts{P,W} = PositionCoefs{P,Tuple{W}}
71-
weightedindexes(parts::Vararg{Union{Int,ValueParts},N}) where N = maybe_weightedindex.(positions.(parts), valuecoefs.(parts))
71+
@inline weightedindexes(parts::Vararg{Union{Int,ValueParts},N}) where N = maybe_weightedindex.(positions.(parts), valuecoefs.(parts))
7272
maybe_weightedindex(i::Integer, _::Integer) = Int(i)
7373
maybe_weightedindex(pos, coefs::Tuple) = WeightedIndex(pos, coefs)
7474

0 commit comments

Comments
 (0)