WebGPURenderer: Remove inline functions in rendering methods.#33108
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
Do you mind splitting the PR in smaller changes and just update I think it makes sense to remove the inline functions in |
render() performance boost: avoid 4x object allocation in Renderer._renderObjectDirect()render() performance boost (Part 1): avoid 4x object allocation in Renderer._renderObjectDirect()
render() performance boost (Part 1): avoid 4x object allocation in Renderer._renderObjectDirect()render() performance boost (remove closures): avoid 4x object allocation in Renderer._renderObjectDirect()
render() performance boost (remove closures): avoid 4x object allocation in Renderer._renderObjectDirect()render() performance boost Part 1 (remove closures): avoid 4x object allocation in Renderer._renderObjectDirect()
…try attribute changes to another PR.
Here is the new PR for the For some reason the "Files Changed" comparison view for this PR is all jacked up. All I did was turn the |
render() performance boost Part 1 (remove closures): avoid 4x object allocation in Renderer._renderObjectDirect()|
Added JSDoc and slightly updated the signature of |
|
We should avoid object allocation in hot code paths whenever possible so the changes of this PR are indeed wanted. |
Related issue: #33107
Description
This PR ensures that no objects are allocated in the
Renderer._renderObjectDirect()hot path that gets called for each mesh per render.From my testing this has produced a 20% gain in the performance of
Renderer.render(), plus the added benefit of far less garbage being generated in arender()loop.You can test this PR live at the following JSFiddle: https://jsfiddle.net/v14csauf
Garbage Accumulation