SIMD vectorization of Length.cpp, runs up to 2.8x faster. #1331
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.
Hello,
This PR increases the speed of Length.cpp by 1.13x - 2.83x by enabling the compiler to use SIMD vector instructions with SIMD directives. This is done safely by checking
#ifdef HAVE_OPEN_SIMDso if the preprocessor macro HAVE_OPEN_SIMD has not been defined then the Length.cpp runs as usual.On x86 Linux 32GiB DRAM, Intel i9 performance varied by size of line (# of points) and whether line was a CoordinateSequence or CoordinateXY vector.
`
Points | Vector Gain | CoordinateSequence Gain
`
The speed and throughput testing script I used:
myLengthTest.cpp
I built and ran
cteston both the x86 Linux and an M1 Mac, passed all tests.Thank you,
Sven