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

improvement: Reduce Memory overhead of default appearance array #3882

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Strepto
Copy link
Contributor

@Strepto Strepto commented Nov 8, 2023

Type of change

Feat

Jira ticket 📘

https://cognitedata.atlassian.net/browse/

Description 📝

Today the default appearance array allocates an array of the size of the input texture. If we have over 8mill nodes this is about 67MB (4k x 4k x 4bytes) array allocated with the same 4 bytes repeated 16 million times.

We split it into multiple arrays to avoid memory waste, while also improving performance!

The PR is a bit WIP, as I need to test it a bit more. But currently this approach saves 10% time, and 95% memory on worst case performance (4k texture) compared to the old approach.

How has this been tested? 🔍

Test instructions ℹ️

Checklist ☑️

  • I am proud of this feature.
  • I have performed a self-review of my own code.
  • I have added PR type (Feat, Bug, Chore, Test, Docs, Style, Refactor) to the PR title.
  • I have manually tested this for different scenarios (different models, formats, devices, browsers).
  • I have commented my code in hard-to-understand areas.
  • I have made corresponding changes to the public documentation.
  • I have added unit and visuals tests to prove that my feature works to the best of my ability.
  • I have refactored the code for readability to the best of my ability.
  • I have checked that my changes do not introduce regressions in the public documentation.
  • I have outlined any known defects / lacking capabilities in the contents of this PR.
  • I have listed any remaining work that should follow this PR in the description or jira/miro/etc.
  • I have added TSDoc to any public facing changes.
  • I have added "developer documentation" in any package README.md that is related / applicable to this PR.
  • I have noted down and am currently tracking any technical debt introduced in this PR.
  • I have thoroughly thought about the architecture of this implementation.
  • I have asked peers to test this feature.

This allocates an array of the size of the input texture.
If we have over 8mill nodes this is about 67MB
array allocated with repeating data

We split it into multiple arrays to avoid memory, while keeping fast
performance.
Copy link

codecov bot commented Nov 10, 2023

Codecov Report

Merging #3882 (0414be6) into master (a987ab4) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3882      +/-   ##
==========================================
+ Coverage   73.54%   73.55%   +0.01%     
==========================================
  Files         357      357              
  Lines       35855    35875      +20     
  Branches     2734     2734              
==========================================
+ Hits        26369    26389      +20     
  Misses       9381     9381              
  Partials      105      105              
Files Coverage Δ
...ring/src/rendering/NodeAppearanceTextureBuilder.ts 98.05% <100.00%> (+0.13%) ⬆️

@Strepto Strepto marked this pull request as ready for review December 6, 2023 08:49
@Strepto Strepto requested a review from a team as a code owner December 6, 2023 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant