Skip to content

Eagerly do boundscheck when indexing CartesianIndices with CartesianIndices #42235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

johnnychen94
Copy link
Member

Separated from #42119

@johnnychen94 johnnychen94 added arrays [a, r, r, a, y, s] performance Must go faster labels Sep 13, 2021
end
@inline Base.getindex(iter::CartesianIndices{0}, ::CartesianIndices{0}) = iter
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is used to override https://github.com/JuliaLang/julia/pull/42235/files#diff-48078500d9f5159df325b49822b85da1d8d43a8499807290d082406fba29e1cdR357-R359 to still get an array output because
getindex(iter, C.indices...) will degraded to getindex(iter) if iter <: CartesianIndices{0}.

@johnnychen94 johnnychen94 force-pushed the jc/boundscheck_cartesion branch from fc5b905 to c69e46d Compare February 14, 2022 11:15
@johnnychen94
Copy link
Member Author

johnnychen94 commented Feb 15, 2022

c69e46d is a rebase on master without any new changes. Since the test passes, I think it's good to merge?

@johnnychen94 johnnychen94 added the merge me PR is reviewed. Merge when all tests are passing label Feb 15, 2022
@DilumAluthge DilumAluthge merged commit 7a1c20e into JuliaLang:master Feb 17, 2022
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Feb 17, 2022
@johnnychen94 johnnychen94 deleted the jc/boundscheck_cartesion branch February 17, 2022 04:36
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request Feb 17, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants