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

Avoid using delete when removing features #41

Open
Nesciosquid opened this issue Dec 15, 2015 · 2 comments
Open

Avoid using delete when removing features #41

Nesciosquid opened this issue Dec 15, 2015 · 2 comments

Comments

@Nesciosquid
Copy link
Contributor

The Layer class has method removeFeatureByID(featureID) which uses the delete operation to remove a feature from its features array.

Delete is slow! Find a better way to store features to improve performance.

@tjsangster
Copy link

tjsangster commented Dec 17, 2020

I believe Map would be better suited for the 'features' property of this class than Object. If this property was updated to an instance of Map, we could remove this delete operation as well as the 'featureCount' property.

EDIT: Now that I've had a chance to look more into the use of this class, it appears that the 'features' property is used too often in other files to make this change easily. I'll leave this comment here for Ideas, but I don't think I'll be acting on it for some time.

@rkrishnasanka
Copy link
Collaborator

@tjsangster yeah that would be a possibility, we might need to switch up the drawing architecture at a later point. Right now we heavily rely on the features object for hit-testing and a bunch and keeping track of what's being rendered. But keep the ideas flowing, it'll be good to revisit them.

@rkrishnasanka rkrishnasanka added this to the TypeScript Port milestone Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants