-
Notifications
You must be signed in to change notification settings - Fork 982
Significantly improved performance of clustersDbscan #2885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…er is better suited to static sets of points such as those processed in this module.
// Input validation being handled by Typescript | ||
// TODO oops! No it isn't. Typescript doesn't do runtime checking. We should | ||
// re-enable these checks, though will have to wait for a major version bump | ||
// as more restrictive checks could break currently working code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah there's a philosophical argument on whether these should be static checks or runtime checks. We've gone back and forth on it over the years.
} | ||
return ( | ||
geokdbush | ||
// @ts-expect-error - until https://github.com/mourner/geokdbush/issues/20 is resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the error number that we're expecting just so its a little more safe?
tsup: | ||
specifier: ^8.4.0 | ||
version: 8.4.0(postcss@8.5.3)(tsx@4.19.4)(typescript@5.8.3) | ||
version: 8.4.0(postcss@8.5.3)(tsx@4.19.4)(typescript@5.8.3)(yaml@2.7.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever caused this resolution to change added a second copy of tsup even though it's the same version. We should probably run pnpm dedupe
again. Probably easiest in a follow up PR unless the diff is very small in this same PR.
import { degreesToRadians, lengthToDegrees, Units } from "@turf/helpers"; | ||
import { rbush as RBush } from "./lib/rbush-export.js"; | ||
import { Units } from "@turf/helpers"; | ||
import KDBush from "kdbush"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love kdbush, it's saved my bacon a few times now.
clustersDbscan seemed to exhibit a sharp decrease in performance when processing large numbers of points. Thanks to some input from the author of the existing rbush library @mourner, it was suggested another library they author might be a better fit. geokdbush caters more to static input data which is all Turf needs in the case of clustersDbscan.
The performance improvement was .. impressive.
All regression tests pass and changes within clustersDbscan have been limited to one functional area. License looks to be compatible with Turf's.
Resolves #2817
contributors
field ofpackage.json
- you've earned it! 👏