-
Notifications
You must be signed in to change notification settings - Fork 20
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
refac: TreeIndexToSectorMap optimize #3697
Merged
haakonflatval-cognite
merged 4 commits into
cognitedata:master
from
equinor:nih/feat/treeindexmap_optimize
Sep 28, 2023
Merged
refac: TreeIndexToSectorMap optimize #3697
haakonflatval-cognite
merged 4 commits into
cognitedata:master
from
equinor:nih/feat/treeindexmap_optimize
Sep 28, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #3697 +/- ##
=======================================
Coverage 71.70% 71.71%
=======================================
Files 346 346
Lines 33762 33766 +4
Branches 2650 2650
=======================================
+ Hits 24210 24214 +4
Misses 9445 9445
Partials 107 107
|
viewer/packages/cad-model/src/utilities/TreeIndexToSectorsMap.ts
Outdated
Show resolved
Hide resolved
Reduces allocation by using array instead of set for values. Uses indices instead of a set for lookup
Strepto
force-pushed
the
nih/feat/treeindexmap_optimize
branch
from
September 19, 2023 07:18
4dfb552
to
3d19a0d
Compare
eiriklegernaes
approved these changes
Sep 19, 2023
eiriklegernaes
approved these changes
Sep 19, 2023
haakonflatval-cognite
approved these changes
Sep 28, 2023
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.
LGTM 👍
I ran some tests - they showed a slightly higher average FPS, while the memory use is much smaller. Nice contribution!
haakonflatval-cognite
added
the
auto-update
Makes bulldozer automatically update this PR when there are changes to the target branch
label
Sep 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
auto-update
Makes bulldozer automatically update this PR when there are changes to the target branch
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Jira ticket 📘
https://cognitedata.atlassian.net/browse/
Description 📝
Builds upon the changes in #3695 , consider reviewing that first
Allocating a new Set for each treeindex in the model has some memory overhead when profiled.
Stats for a custom sample model scene in the reveal "example" viewer:
See JS Heap Size
Initial load of custom 3d model for profiling.
More stats for the camera viewpoint I took all profilings from:
Unique treeIndexes: 347012 Average sectors per treeIndex 1.0567 (The scene.json has ~2.3 million treeindexes so this is just a subset)
Distribution of sectors per TreeIndex in the loaded sectors
When we have so few items the set.has vs array.contains becomes equal or better for array. And the overhead of an Set vs array is considerable when we have millions of them.
How has this been tested? 🔍
Unit test coverage should cover the use.
Tested in browser, and found no performance regression (possible perf increase) and found significant memory saving.
Test instructions ℹ️
Checklist ☑️