Created
August 20, 2018 14:51
-
-
Save damiendr/c21781be4b162f72ed1021f66af595cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Works as expected --- (Base.arrayref)(false, xs, i) in @code_typed: | |
``` | |
function update(xs, i) | |
@inbounds xs[i] += 1 | |
end | |
``` | |
`@inbounds` ignored --- (Base.arrayref)(true, xs, i) in @code_typed: | |
``` | |
@inbounds function update(xs, i) | |
xs[i] += 1 | |
end | |
``` | |
`@simd` fails to vectorize --- (Base.arrayref)(true, xs, i) in @code_typed: | |
``` | |
@inline function update(xs, i) | |
xs[i] += 1 | |
end | |
@inbounds @simd for i in eachindex(xs) | |
update(xs, i) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment