Skip to content

Conversation

@mfedderly
Copy link
Collaborator

There's an interesting part of this change where instead of overriding the rbush object, we wrap it with our own class. This happens to improve perf for me by a little bit, I assume because of still needing to call the rbush.prototype.x methods? I think this is safe to do because we were explicitly defining the geojson version of the rbush interface in index.d.ts, and still adhere to that contract.

// before
rbush.points x 7,847,392 ops/sec ±0.48% (93 runs sampled)
rbush.polygons x 7,917,042 ops/sec ±0.24% (96 runs sampled)
search.points x 23,960,690 ops/sec ±0.20% (97 runs sampled)
search.polygons x 23,708,835 ops/sec ±0.23% (98 runs sampled)

// after
rbush.points x 10,725,369 ops/sec ±0.36% (94 runs sampled)
rbush.polygons x 10,858,871 ops/sec ±0.24% (97 runs sampled)
search.points x 25,365,964 ops/sec ±0.39% (100 runs sampled)
search.polygons x 26,213,881 ops/sec ±0.25% (99 runs sampled)

@mfedderly mfedderly merged commit 31d5199 into master Dec 31, 2025
4 checks passed
@mfedderly mfedderly deleted the mf/geojson-rbush-ts branch December 31, 2025 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants