-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
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
Benchmarks: Update world transforms / updateMatrixWorld() - improve benchmark realism #25113
Benchmarks: Update world transforms / updateMatrixWorld() - improve benchmark realism #25113
Conversation
I've done a little more experimentation & exploration on this topic. A few additional points worth noting.
Some other articles I found on the topic (googling "megamorphic V8") that look pretty useful /relevant: |
More experimentation, and I have found another factor that makes a big difference. I've done a couple of types of tests:
What I've learned...
I've also tried running these tests with the fix in #25114. As you might hope/expect:
So overall there are 2 factors in play here:
|
Based on the analysis above, I now think I'm in a position to propose an improved set of benchmarks, and have updated the PR with what I'm proposing, and will convert from Draft to "Ready for Review". Rationale for including these:
I'm quite deep into this topic at the moment, so it's possible I am over-egging the amount of tests needed here, and overlooking costs that arise from having too many tests. If I had to cut back on this, I'd probably cut back on the SkinnedMesh (I don't imagine it's widely used at great scale) - all the others I think have a pretty cast-iron case for inclusion. In the other direction, if I were to extend to include even more tests, I think I'd extend to include a monomorphic test for each individual sub-class of Object3D, to check for & monitor variations in performance between different classes. For reference, a preview of what these benchmarks look like with the prototype fix for #25114 |
This reverts commit 1ba542c.
Closing since the benchmarks have been removed. |
Related issue: #25115
Description
See related issue for full background.
This PR addresses an issue with the existing Benchmark tests for updateMatrixWorld()
The issue is that the benhmark test generates a completely homogeneous set of Object3Ds, which results in the code iterating over a monomorphic set of objects - which will result in very flattering performance vs. real world usage.
Evidence that this is a real issue is provided by observing that the benchmark added in this PR, with a randomized, heterogeneous set of Object3Ds performs 50% slower than the equivalent homegeneous benchmark.
I don't expect this PR to be merged in its current state.
It's intended to share the code for the new "real world" benchmark test, to highlight the substantial performance gap between homegeneous & heterogeneous benchmark tests, and to open a discussion about what the best parameters would be for a Benchmark test that is representative of real-world use-cases for Three.js.
PR #25114 is related and offers a prototype fix that significantly improves performance on the new benchmark added by this PR.