Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed broadcast! into bitarray algorithm (#32048)
Cf https://discourse.julialang.org/t/broadcast-vs-slow-performance-allocations/24259/6 for some more discussion and #32047 for the question of validity in view of exceptions. Before: ``` julia> using BenchmarkTools, Random julia> y=1; xsmall=[1]; Random.seed!(42); xlarge=rand(1:4, 100_003); julia> @Btime broadcast(==, $xsmall, $y); @Btime broadcast(==, $xlarge, $y); @show hash(broadcast(==, xlarge, y).chunks); 860.500 ns (3 allocations: 4.31 KiB) 152.971 μs (3 allocations: 16.59 KiB) hash((broadcast(==, xlarge, y)).chunks) = 0xaa3b5a692968e128 ``` After: ``` julia> @Btime broadcast(==, $xsmall, $y); @Btime broadcast(==, $xlarge, $y); @show hash(broadcast(==, xlarge, y).chunks); 65.466 ns (2 allocations: 128 bytes) 42.927 μs (2 allocations: 12.41 KiB) hash((broadcast(==, xlarge, y)).chunks) = 0xaa3b5a692968e128 ``` Co-authored-by: Jameson Nash <vtjnash@gmail.com>
- Loading branch information