Bersaelor / KDTree

Swift implementation of a k-dimensional binary space partitioning tree.
MIT License
153 stars 26 forks source link

Speed up initialization / cache? #47

Closed dockay closed 4 years ago

dockay commented 5 years ago

First thanks for your pod, helped us a lot. A quick question/feature-request, is there any way to save the data after the tree has been setup? We have 60k points with 2 dimensions, it takes nearly 1 minute to init, so we don't want that this happens every start of the app. Perhaps there is even a way that any type of backend can provide some pre-built data?

peteraisher commented 4 years ago

A quick question/feature-request, is there any way to save the data after the tree has been setup?

Yes, KDTree conforms to Encodable and Decodable, so if your Element data also conforms to these protocols, you can use the functions in KDTree+Codable.swift to read and write a complete tree to/from storage

We have 60k points with 2 dimensions, it takes nearly 1 minute to init …

That should be faster now too in the latest version.

Bersaelor commented 4 years ago

Closing as resolved.