NREL / floorspace.js

Other
66 stars 35 forks source link

refactor(geometry): add edgesMap #366

Open macintoshpie opened 4 years ago

macintoshpie commented 4 years ago

Partially addresses some performance issues by adding a hashmap of edges to the geometry objects. This allows the helper function edgeById to run in ~O(1) time - which is called many times when deleting spaces.

This is not the ideal solution as it replicates state in the store (in geometry.edges and geometry.edgesMap), but is a good first step with improved performance. The following step would be to consider refactoring geometry.edges array into an array of id's

Changes/Additions