Skip to content

Commit

Permalink
avoid more tuple allocations in Array constructors
Browse files Browse the repository at this point in the history
(cherry picked from commit 7a05b3b)
ref #18918
  • Loading branch information
JeffBezanson authored and tkelman committed Feb 22, 2017
1 parent c427de0 commit e776d78
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ typealias NTuple{N,T} Tuple{Vararg{T,N}}
# primitive array constructors
(::Type{Array{T,N}}){T,N}(d::NTuple{N,Int}) =
ccall(:jl_new_array, Array{T,N}, (Any,Any), Array{T,N}, d)
(::Type{Array{T,1}}){T}(d::NTuple{1,Int}) = Array{T,1}(getfield(d,1))
(::Type{Array{T,2}}){T}(d::NTuple{2,Int}) = Array{T,2}(getfield(d,1), getfield(d,2))
(::Type{Array{T,3}}){T}(d::NTuple{3,Int}) = Array{T,3}(getfield(d,1), getfield(d,2), getfield(d,3))
(::Type{Array{T,1}}){T}(m::Int) =
ccall(:jl_alloc_array_1d, Array{T,1}, (Any,Int), Array{T,1}, m)
(::Type{Array{T,2}}){T}(m::Int, n::Int) =
Expand Down

2 comments on commit e776d78

@tkelman
Copy link
Contributor

@tkelman tkelman commented on e776d78 Mar 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at commit e776d78: @nanosoldier runbenchmarks(ALL, vs = "@3c9d75391c72d7c32eea75ff187ce77b2d5effc8")

narrowing down what caused the "array","convert" slowdown

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

Please sign in to comment.