GLTFLoader: minor optimization
See original GitHub issueDescription of the problem
can be slightly optimized. Also see https://github.com/KhronosGroup/glTF/issues/1411#issuecomment-410356033
Rearranging to
var s2 = - 2 * ppp + 3 * pp;
var s3 = ppp - pp;
var s0 = 1 - s2;
var s1 = s3 - pp + p;
saves three multiplications during each cubicspline animation frame. Still, not sure if worth it as this may not make a measurable difference.
Three.js version
- Dev
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
glTF model rendering optimization - Questions - three.js forum
My question is how to optimize the model in order for it to be able to run ... I have another question though,...
Read more >How to Import GLTF Models in Three.js - YouTube
In this coding tutorial, we go over importing GLTF models in Three JS. We start off by learning when it is useful to...
Read more >How to Load a 3D model in Three.js - YouTube
How to Load a 3D model in Three.js | GLTF/GLB Model | GLTFLoader ... I may receive a small commission for purchases made...
Read more >loaders.gl - Yarn
loaders.gl. loaders.gl is a framework in the vis.gl framework suite that provides a collection of framework-independent loaders focused on geospatial, ...
Read more >Three.js Multiple Canvases Multiple Scenes
The code above works but there is one minor issue. If your scenes are complicated or if for whatever reason it takes too...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this type of optimization should be done by JavaScript Engine. We don’t need to do manually. We should just keep the code simple and readable as much as possible.
Weird that Chrome becomes faster with this change. I know micro benchmark test framework sometimes doesn’t fairly compare the performance. I’ll write the test by myself and share the result.
Tested in Chrome, Firefox, and Safari. It wasn’t consistent across multiple runs. Running the same test in Firefox repeatedly sometimes showed one or the other as faster. Safari was more consistent, with code block 2 being slightly faster. Overall the trend appears to be slightly faster, and intuitively that makes sense, so I’m happy with the PR.