Open
Description
The eager automatic conversion introduced in #227 (cc @timholy @piever) leads to many allocations when this conversion isn't actually needed.
For example:
[email protected] - 25 allocations:
julia> using StructArrays, ArraysOfArrays
julia> A = StructArray(x=VectorOfVectors{Int}())
julia> @time for _ in 1:10^6 push!(A, (x=1:10,)) end
0.307580 seconds (25 allocations: 11.269 MiB, 7.45% gc time)
[email protected] - 1 million allocations:
julia> using StructArrays, ArraysOfArrays
julia> A = StructArray(x=VectorOfVectors{Int}())
julia> @time for _ in 1:10^6 push!(A, (x=1:10,)) end
0.809896 seconds (1.00 M allocations: 293.601 MiB, 55.02% gc time)
Of course, these allocations go away if automatic conversion (
Lines 197 to 199 in 1581d70
StructArrays.maybe_convert_elt(::Type{T}, vals::Tuple) where {T} = vals
.
This change in 0.6.8 is highly breaking performance-wise. Can the new automatic conversion approach be revised and made less eager somehow?
Metadata
Metadata
Assignees
Labels
No labels