Skip to content
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

chore(dev/benchmarks): Benchmark coordinate sequence iteration #112

Merged
merged 9 commits into from
Jan 7, 2025

Conversation

paleolimbot
Copy link
Contributor

@paleolimbot paleolimbot commented Jan 6, 2025

This PR benchmarks coordinate iteration (and fixes the previous benchmarks benchmark the same cases). Some takeaways:

  • In C, GEOARROW_COORD_VIEW_VALUE(), which uses i * coord_stride, seems to prevent the compiler from doing some optimization which is possible when incrementing the pointer by coord_stride in each iteration of the loop. However, this only affects bounds calculation and not the centroid calculation.
  • In C++, the STL iterator does a slightly better job optimizing i * coord_stride and in one case seems to do slightly better.

This PR also adds "dimension iterators" dbegin() and dend() 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).

@paleolimbot paleolimbot marked this pull request as ready for review January 6, 2025 06:48
@paleolimbot paleolimbot merged commit db02936 into geoarrow:main Jan 7, 2025
9 checks passed
@paleolimbot paleolimbot deleted the benchmarks-more branch January 7, 2025 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant