-
Notifications
You must be signed in to change notification settings - Fork 56
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
Performance Improvements #32
Comments
Thanks for the suggestions!
|
@jbuckmccready pushed the second idea (preallocating stack) to https://github.com/mourner/flatbush/tree/preallocate-stack but it doesn't seem to show any perf improvements. 🤷♂ |
For the preallocated stack I think for many JIT/garbage collected languages it's not an issue because the buffer gets reused/lifted out of the loop, or the garbage collector is just very optimized for the repeated small block allocations. It may be more impactful if there are many other allocations in between the search calls to add pressure to the garbage collector, but I doubt it will be as significant as in a non-garbage collected language. Sorry nothing I found was of much use! 😬 |
Related to investigating the radix sort mentioned in #30 I found a few other ways to improve performance in my c++ usage.
In the quicksort function when the sub array is small enough (I found 8 to be a good size) switch to insertion sort, this resulted in about a 3% improvement when indexing.
When searching/querying the index I allow an existing container to be passed in to be used for both the results and the stack for traversal. This was a huge performance boost (20-30%) since I often perform the search in tight loops which would involve many allocation/deallocations for both the results and stack for traversal.
The text was updated successfully, but these errors were encountered: