https://github.com/JuliaLang/julia
Revision f3ae44c3f680312ae75a5e7363de3c70bedeaf0c authored by chethega on 04 November 2023, 13:20:35 UTC, committed by GitHub on 04 November 2023, 13:20:35 UTC
Cf
https://discourse.julialang.org/t/broadcast-vs-slow-performance-allocations/24259/6
for some more discussion and
https://github.com/JuliaLang/julia/issues/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>
1 parent d75a00f
History
Tip revision: f3ae44c3f680312ae75a5e7363de3c70bedeaf0c authored by chethega on 04 November 2023, 13:20:35 UTC
changed broadcast! into bitarray algorithm (#32048)
Tip revision: f3ae44c
File Mode Size
.devcontainer
.github
base
cli
contrib
deps
doc
etc
src
stdlib
test
.buildkite-external-version -rw-r--r-- 5 bytes
.clang-format -rw-r--r-- 3.3 KB
.clangd -rw-r--r-- 114 bytes
.codecov.yml -rw-r--r-- 52 bytes
.git-blame-ignore-revs -rw-r--r-- 371 bytes
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 523 bytes
.mailmap -rw-r--r-- 12.7 KB
CITATION.bib -rw-r--r-- 513 bytes
CITATION.cff -rw-r--r-- 940 bytes
CONTRIBUTING.md -rw-r--r-- 23.4 KB
HISTORY.md -rw-r--r-- 372.8 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 55.9 KB
Makefile -rw-r--r-- 30.3 KB
NEWS.md -rw-r--r-- 5.0 KB
README.md -rw-r--r-- 7.3 KB
THIRDPARTY.md -rw-r--r-- 3.8 KB
VERSION -rw-r--r-- 11 bytes
julia.spdx.json -rw-r--r-- 35.8 KB
pkgimage.mk -rw-r--r-- 6.1 KB
sysimage.mk -rw-r--r-- 4.2 KB
typos.toml -rw-r--r-- 78 bytes

README.md

back to top