Skip to content

Commit 7d056d2

Browse files
committed
Fix performance regression from c330b1d
StoredArray is more specific than AbstractVector{T}, so we were performing unnecessary copies when calling `int` etc. This caused a regression on the add1 benchmark, since we call `int` in `getindex`.
1 parent 206dbe3 commit 7d056d2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

base/abstractarray.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ for (f,t) in ((:char, Char),
248248
(:uint128,Uint128))
249249
@eval begin
250250
($f)(x::AbstractArray{$t}) = x
251+
($f)(x::StoredArray{$t}) = x
251252

252253
function ($f)(x::StoredArray)
253254
y = similar(x,$t)
@@ -265,6 +266,7 @@ for (f,t) in ((:integer, Integer),
265266
(:unsigned, Unsigned))
266267
@eval begin
267268
($f){T<:$t}(x::AbstractArray{T}) = x
269+
($f){T<:$t}(x::StoredArray{T}) = x
268270

269271
function ($f)(x::StoredArray)
270272
y = similar(x,typeof(($f)(one(eltype(x)))))

0 commit comments

Comments
 (0)