3DuF icon indicating copy to clipboard operation
3DuF copied to clipboard

Avoid using delete when removing features

Open Nesciosquid opened this issue 9 years ago • 2 comments

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.

Nesciosquid avatar Dec 15 '15 21:12 Nesciosquid

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.

tjsangster avatar Dec 17 '20 23:12 tjsangster

@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 avatar Dec 18 '20 15:12 rkrishnasanka