https://github.com/JuliaLang/julia
Revision d54a4550cbe2892014609c1cc797f129a9ccb1ee authored by Jishnu Bhattacharya on 02 February 2024, 07:09:12 UTC, committed by GitHub on 02 February 2024, 07:09:12 UTC
As noted by @N5N3 in
https://github.com/JuliaLang/julia/issues/40962#issuecomment-1921469633,
the bounds-check on the elementwise `setindex!` prevents vectorization.
Explicitly performing the bounds-check and marking the `setindex!` as
`@inbounds` speeds up the operation.
```julia
julia> A = zeros(1000); B = rand(1000);

julia> @btime $A[1:end] = @view $B[1:end];
  689.940 ns (0 allocations: 0 bytes) # master
  97.629 ns (0 allocations: 0 bytes) # PR
```
1 parent 058b511
History
Tip revision: d54a4550cbe2892014609c1cc797f129a9ccb1ee authored by Jishnu Bhattacharya on 02 February 2024, 07:09:12 UTC
Hoist boundscheck in vector setindex for arrays (#53149)
Tip revision: d54a455
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.2 KB
NEWS.md -rw-r--r-- 11.1 KB
README.md -rw-r--r-- 7.4 KB
THIRDPARTY.md -rw-r--r-- 3.9 KB
VERSION -rw-r--r-- 11 bytes
julia.spdx.json -rw-r--r-- 37.8 KB
pkgimage.mk -rw-r--r-- 5.9 KB
sysimage.mk -rw-r--r-- 4.2 KB
typos.toml -rw-r--r-- 78 bytes

README.md

back to top