Skip to content

Conversation

@finetjul
Copy link
Member

Context

Rendering is slow when a scene has many actors. This is slow since addMissingNodes() enforceOrder has been added.

Results

Performance should be back to before what they were before enforceOrder was added.

Changes

Add caching for OpenGLCamera node and do not enforce data objs to be at the beginning of the children list.

  • Documentation and TypeScript definitions were updated to match those changes

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js:
    • OS:
    • Browser:

@finetjul finetjul requested a review from sankhesh November 21, 2025 22:43
@finetjul finetjul force-pushed the 3351-fix-many-actors-performance-hit branch 2 times, most recently from 6c6b2da to 9004dee Compare November 22, 2025 20:36
@daker
Copy link
Collaborator

daker commented Nov 22, 2025

@finetjul Does this improve the interaction with the scene when we have many actors ? ex in https://kitware.github.io/vtk-js/examples/IFCImporter/index.html?mergeGeometries=false

@daker
Copy link
Collaborator

daker commented Nov 22, 2025

Another thing that still bugs me is the memory usage in general and specifically GLTFImporter, i am not sure if it's the code i wrote or something in VTK.js that keeps arrays.

DamangedHelmet is 7x the memory usage compared to Threejs for example

Copy link
Collaborator

@daker daker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, i did test it with IFC example it does improve the interaction with the scene.

Avoid using filter() and includes() that are slow operations.

issue Kitware#3351
Provide the previously found view node to avoid a full search each time
a prepass of buildPass is done

issue Kitware#3351
enforceOrder was forcing the dataObjs nodes to be the first children. That had the disadvantage to
make the OpenGLCamera the last item, and slow to be found. Instead, enforceOrder now simply enforce
that the created missing nodes are following each others.

fix #3497
@finetjul finetjul force-pushed the 3351-fix-many-actors-performance-hit branch from 9004dee to aef841e Compare November 23, 2025 20:49
Copy link
Collaborator

@sankhesh sankhesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

3 participants