---
updatedAt: 2026-09-16T22:25:42.000Z
agentTools:
  projectIndex: https://docs.thousandbrains.org/llms.txt
---

# Find Faster Alternative to KDTree Search

KD-Tree search is Monty's biggest speed bottleneck, so optimizing this would be beneficial.

As discussed in these videos on Monty's speed ([part 1](https://youtu.be/JVz0Km98hLo), [part 2](https://youtu.be/XSg6UwGti4c)), KD-Tree search is the operation that Monty currently spends most time one.

Collin did a comparison of different methods in May 2025 and found that our current method was the best for our use case at the moment. For the full results, see [this thread](https://forum.thousandbrains.org/t/gpu-acceleration-of-knn-search-update/620). However, there may be other nearest neighbor algorithms that were not tested there and that would do better in our scenario (finding nearest neighbors in 3D space).

Also see [this thread](https://forum.thousandbrains.org/t/possibility-of-faster-recognition-with-monty/574/4) on Discourse for more information of other speedups and KD-Tree alternatives we explored.

<style>
.contribution-button {
    border-radius: 5px;
    background-color: #EFEFEF;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 5px;
    padding-bottom: 5px;
    color: black;
    weight: bolder;
    display: inline-flex;
    margin-top: -10px;
    align-items: center;
    border: 1px solid #CCCCCC;
    text-decoration: none !important;
}
.contribution-button:hover {
    background-color: #DDDDDD;
    cursor: pointer;
    color: black;
}
</style>

<br><br>

***

#### Help Us Make This Page Better

All our docs are open-source. If something is wrong or unclear, submit a PR to fix it!

<a class="contribution-button" href="https://github.com/thousandbrainsproject/tbp.monty/edit/main/docs/future-work/framework-improvements/find-faster-alternative-to-kdtree-search.md" target="_blank">Make a Contribution</a>

[Learn how to contribute to our docs](/docs/documentation)