gx0r / rrgeo

A fast, offline, reverse geocoder
Apache License 2.0
122 stars 10 forks source link

performance: switch to kiddo kd tree library for ~800x improvement on benchmark 😲 #8

Closed sdd closed 2 years ago

sdd commented 2 years ago

I tried a little experiment and switched out the old kdtree library for kiddo, a performance-improved fork of the now 2-year-old kdtree. (fair disclosure: I'm the maintainer of kiddo).

This resulted in a huge improvement in performance on the benchmark. Tested on a Ryzen 5900X, I got the following result for the old master branch:

image

316.1 microseconds.

After my refactoring, I got the following result:

image

409.9 nanoseconds - i.e. 0.4 microseconds! Faster by a factor of 790 😎

gx0r commented 2 years ago

This is amazing! I heard about kiddo a few months ago and at the time I don't think I could get it to work! Wow! Thank you!!