v2.1.0
- feat: implement the main query methods plus
size
onkiddo::float::kdtree::ArchivedKdTree
and improve the rkyv example.
The previous Rkyv example was not really using Rkyv in the most efficient way (Thanks to @cavemanloverboy for spotting my mistakes!). In order to properly use rkyv'z zero-copy deserialization, you need to use rkyv::archived_root
to transmute a buffer into an ArchivedKdTree
. For ArchivedKdTree
to be useful, it actually needs some methods though!
v2.1.0 refactors the query code so that the method bodies of the queries are templated by macros, allowing them to be implemented on KdTree
and ArchivedKdTree
without completely duplicating the code.
The updated rkyv example shows the difference that zero-copy usage of rkyv makes vs deserializing, as well as also showing the gains that can be made using mmap compared to standard file access. Combining both together results in absolutely mind-blowing performance when measuring time-from-binary-start-to-first-query-result.
See for yourself by downloading the sample datasets mentioned in the examples readme and running:
cargo run --example rkyv --features=serialize_rkyv --release
On my machine, using the old technique of normal file access and deserialization into KdTree
, the example code takes 348 milliseconds to load and query. The memmapped code that just transmutes to an ArchivedKdTree
and then queries it takes 182 micro seconds(!) - an improvement by a factor of 1900x!!
I'll follow up this release with equivalent methods for Fixed
, and some more ergonomic methods for loading and saving.