Mike M. answered 17d
Data Scientist | 20+ Yrs in ML, Python, SQL, and Real-World Modeling
Short answer: you don’t need to add your own quadtree. OpenLayers already indexes vector features with an R-tree (RBush) and forEachFeatureAtPixel uses that index for hit-testing. You’ll usually get bigger wins by narrowing what gets tested and by querying a source’s index directly.