chore(dev/benchmarks): Benchmark coordinate sequence iteration #112
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 PR benchmarks coordinate iteration (and fixes the previous benchmarks benchmark the same cases). Some takeaways:
GEOARROW_COORD_VIEW_VALUE()
, which usesi * coord_stride
, seems to prevent the compiler from doing some optimization which is possible when incrementing the pointer bycoord_stride
in each iteration of the loop. However, this only affects bounds calculation and not the centroid calculation.i * coord_stride
and in one case seems to do slightly better.This PR also adds "dimension iterators"
dbegin()
anddend()
for iterating over a particular dimension.My personal takeaway is that except for possibly very cheap operations (like bounding, winding, and centroid calculations), C++ STL iteration is probably fine. A good reason to use dimension-specific iteration is if you are specifically aiming for autovectorization of some kind (or if you specifically are discarding values from another dimension).