Skip to content
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

Euclidean metric is much slower than Angular? #41

Closed
ronxin opened this issue Dec 21, 2014 · 2 comments
Closed

Euclidean metric is much slower than Angular? #41

ronxin opened this issue Dec 21, 2014 · 2 comments

Comments

@ronxin
Copy link
Contributor

ronxin commented Dec 21, 2014

I am running an experiment with 1.2 million nodes, each represented by a 500-dim vector. On the same machine, when using Angular distance, it takes about 1 minute to build a tree; whereas using Euclidean, it takes about 1 hour. Is this difference caused by Euclidean distance having to calculate an extra offset value, or other things?

@erikbern
Copy link
Collaborator

I never used Euclidean distance much, so the code isn't very optimized. There's some hacky stuff in create_split that's really slow for Euclidean, and it's probably not super hard to optimize if you have some time to spend on it: https://github.com/spotify/annoy/blob/master/src/annoylib.h#L193

@erikbern
Copy link
Collaborator

See #65 – this makes Euclidean indexes substantially faster

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

No branches or pull requests

2 participants