Skip to content

Conversation

@mrdoob
Copy link
Owner

@mrdoob mrdoob commented Nov 28, 2025

Description

This PR addresses several V8 deoptimization patterns in the WebGPU renderer to improve performance and stability.

  • RenderObject.js: Optimized getKeys by caching prototype keys in a WeakMap, significantly reducing reflection overhead.
  • Renderer.js, Nodes.js, NodeBuilder.js, UniformNode.js: Replaced delete keyword usage with undefined assignment to prevent hidden class transitions and keep object shapes stable.

These changes ensure more stable hidden classes and reduce garbage collection overhead associated with dictionary mode objects.

@mrdoob mrdoob added this to the r182 milestone Nov 28, 2025
@mrdoob mrdoob requested a review from sunag November 28, 2025 11:30
@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 350.27
83.05
350.27
83.05
+0 B
+0 B
WebGPU 613.66
170.42
613.75
170.45
+88 B
+30 B
WebGPU Nodes 612.26
170.14
612.35
170.18
+88 B
+33 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 482.26
117.84
482.26
117.84
+0 B
+0 B
WebGPU 684.8
186.19
684.89
186.23
+88 B
+36 B
WebGPU Nodes 634.64
173.38
634.73
173.42
+88 B
+38 B

@mrdoob mrdoob modified the milestones: r182, r183 Nov 28, 2025
@Makio64
Copy link
Contributor

Makio64 commented Dec 2, 2025

@mrdoob its super nice! Im curious how you are testing all these recent improvements?

@mrdoob
Copy link
Owner Author

mrdoob commented Dec 2, 2025

@mrdoob its super nice! Im curious how you are testing all these recent improvements?

In different ways. Which ones are you curious about?

@Makio64
Copy link
Contributor

Makio64 commented Dec 3, 2025

@mrdoob I saw for the visual one its very straightforward image comparaison + reference blender/khronos , but for this one and the one about really small performance gain i cant even notice on my devices usually, so curious if its directly from profiler or other tooling ?

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