slightly speed up cartesian indexing #51606
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a minor simplification to the multidimensional iteration code that behaves slightly better in the presence of possible overflow (at least according to LLVM. This was found when looking into performance regressions caused by #51319 since that makes
Array
rely more on the regular multidimensional code rather than being special cased.This PR does remove/alter a few tests, but they are all tests of iteration when given an invalid iterator state which we specifically document as a thing that does not work.
Also worth noting that @vtjnash is the one who actually made these changes. I'm just separating them (with permission) from the memory PR because it's a lot easier to review a ~10 line change than a 5000 line change.