You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is exclusively about ways to construct an array from numbers (one of which uses hcat), not the concatenation of two or more arrays. Might be worth adjusting the wording & title -- I had to read the examples.
johnnychen94
changed the title
array concatenation performance analysis
array construction from numbers: SparseArrays piracy and hvcat overhead
May 15, 2025
johnnychen94
changed the title
array construction from numbers: SparseArrays piracy and hvcat overhead
the performance of array construction from numbers: SparseArrays piracy and hvcat overhead
May 15, 2025
In julia we have two typical ways to concatenate arrays,
[]
cat syntax. This is used most frequently due to its simplicityout = Array{...}(undef, ...); ...
This has the least overhead but it's often too verbose to write itLet's first give the conclusion and the to-do task list:
Conclusions:
[]
syntax is always slower than the array init method. And[x x; y y]
matrix concatenation is too slow to be acceptable.Todo:
[x x; y y]
and array init method should be narrowed. (especially for Julia 1.12)using SparseArrays
Because BenchmarkTools depends on SparseArrays (indirectly) in some Julia versions, I use the following script to run the benchmark:
The text was updated successfully, but these errors were encountered: