-
Notifications
You must be signed in to change notification settings - Fork 18
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
Introduce minPoints option #25
Conversation
02c4dd8
to
d1c3581
Compare
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.
👍
d1c3581
to
7ee4e4e
Compare
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.
Looks good 👍
One suggestion, maybe for a follow-up / investigation work. It looks like we could avoid expensive unordered_map copies between clusters.
if (num_points == 1) { | ||
clusters.emplace_back(weight, 1, p.id, clusterProperties); | ||
} else { | ||
auto clusterProperties = p.properties ? *p.properties : property_map{}; |
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.
clusterProperties
only mutated if num_points >= options_.minPoints
and if we have reduce function. Could we share p.properties
between clusters if no mutation is required?
return; | ||
} | ||
b.visited = true; | ||
clusters.emplace_back(b.pos, 1, b.id, |
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.
Probably, b.properties
can be shared between clusters? Could we change std::unique_ptr<property_map> properties{ nullptr }
to std::shared_ptr<const property_map> properties{ nullptr };
and then try sharing properties between clusters if property map is not changed?
@alexshalamov Thanks for your suggestion! After some initial experiments for property map sharing as you suggested in the comments, I think it worths further investigation, and more tests need to be conducted to make sure it won't break anything. So I created an issue #26 to track it. |
port mapbox/supercluster#156