-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
performanceMust go fasterMust go fasterregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous version
Description
I looked at https://github.com/jrevels/BaseBenchmarkReports/blob/master/c70ab26/c70ab26_vs_adffe19.md which is a test benchmark run that @jrevels ran that compares 0.4.2 with master. There are multiple regressions and I believe that most of them are from changes to unsafe_getindex, and more specifically, _checksize
For example, the benchmark:
function sumvector(A, n)
s = zero(eltype(A)) + zero(eltype(A))
nrows = size(A, 1)
ncols = size(A, 2)
r = rand(1:nrows, 5)
for k = 1:n
for i = 1:ncols
val = Base.unsafe_getindex(A, r, i)
s += first(val)
end
end
s
endBenchmark with A = rand(300, 500).
Master:
julia> @time sumvector(A, 1000);
0.126164 seconds (2.00 M allocations: 83.924 MB, 6.93% gc time)0.4.2:
julia> @time sumvector(A, 1000)
0.034920 seconds (1.00 M allocations: 61.035 MB, 7.24% gc time)Profiling shows that the extra time is spend in _checksize at
julia/base/multidimensional.jl
Line 259 in 128e546
| _checksize(A::AbstractArray, dim, I, J...) = (size(A, dim) == length(I) || throw_checksize_error(A, dim, I); _checksize(A, dim+1, J...)) |
CC: @mbauman since it was last touched in the scalar dimension drop change.
Metadata
Metadata
Assignees
Labels
performanceMust go fasterMust go fasterregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous version