# JuliaLang/julia

improving push() performance on cell arrays

1 parent e114d0d commit c00ae0b44161eb96f48d6269250e47a1f9293efb JeffBezanson committed Apr 29, 2012
Showing with 1 addition and 7 deletions.
1. +0 −2 base/abstractarray.jl
2. +1 −5 base/array.jl
 @@ -302,8 +302,6 @@ end # 1-d indexing is assumed defined on subtypes assign(t::AbstractArray, x, i::Integer) = error("assign not defined for ",typeof(t)) -assign(t::AbstractArray, x::AbstractArray, i::Integer) = - error("assign not defined for ",typeof(t)) assign(t::AbstractArray, x, i::Real) = (t[iround(i)] = x) assign(t::AbstractArray, x, i::Real, j::Real) = (t[iround(i),iround(j)] = x)
 @@ -239,13 +239,9 @@ ref(A::Matrix, I::AbstractVector{Bool}, J::AbstractVector{Bool}) = A[find(I),fin ## Indexing: assign ## -assign(A::Array{Any}, x::AbstractArray, i::Int) = arrayset(A,i,x) assign(A::Array{Any}, x::AbstractArray, i::Integer) = arrayset(A,int(i),x) -assign(A::Array{Any}, x::ANY, i::Int) = arrayset(A,i,x) assign(A::Array{Any}, x::ANY, i::Integer) = arrayset(A,int(i),x) -assign{T}(A::Array{T}, x::AbstractArray, i::Int) = arrayset(A,i,convert(T, x)) assign{T}(A::Array{T}, x::AbstractArray, i::Integer) = arrayset(A,int(i),convert(T, x)) -assign{T}(A::Array{T}, x, i::Int) = arrayset(A,i,convert(T, x)) assign{T}(A::Array{T}, x, i::Integer) = arrayset(A,int(i),convert(T, x)) assign{T}(A::Array{T,0}, x) = arrayset(A,1,convert(T, x)) @@ -436,7 +432,7 @@ end function push(a::Array{Any,1}, item::ANY) ccall(:jl_array_grow_end, Void, (Any, Uint), a, 1) - a[end] = item + arrayset(a, length(a), item) return a end

Member

### nolta commented on `c00ae0b`Apr 29, 2012

 Excellent, now we're twice as fast as python.