Testing the upgrade path to BJS 6.0 and ran into some issues, namely performance…
BJS 6.01
BJS v5.57.1
As you can see, we’re getting very different results… namely, WAY more active meshes, active everything, resulting in way more draw calls.
The above numbers were taken from the exact same camera angle and position in the same scene… and no code has changed.
Can you send me in the right direction here? This is a production product with very deep setup. I’ll try to create a playground, but right now I’m looking for some architectural thoughts on how this might even happen from v5 to v6.
I see, looks pretty interesting. How could the numbers be so distinctive if the scene is the same? Can you doublecheck? You just did an npm update of the packages and this suddenly happened? Can you rollback to v5 (really just install the older libs) and check the counts?
Theyve pushed some perf related updates btw, maybe try on latest. If that doesnt help, I think the bones being there may be some kind of hint, seems weird to go from 0 bones to any
It’s really weird with times of draw calls after update. Do you have RTTs that are not rendered before? Like shadows, depthrenderer or any custom RTTs.
Thanks, yep… I have literally have two versions live… one on v5, live, and one on my local machine. I’ll create a live version of that one… so I can rule out “localhost” issues, which I’ve had (they were related to webpack causing extra function calls) but that was the reverse of this issue performance-wise.
Basically, the scene loads and brings the user to the exact same point on both versions… and you then can see those differences, especially in the active meshes.
Don’t worry about security here… it’s a throw-away account we’ll tear down when done.
After logging in, you’ll se one character called “Test Character.” Click it and it will take you to a SceneGrinder scene. If you do nothing after the scene loads, both scenarios will take you to the exact same camera position and angle.
You can bring up the debugger (assuming your focus is on the scene) by hitting “Alt-Shift-D” and keep in mind the debugger is shoe-horned into the scene, which is react around the edges, and sometimes the debugger doesn’t play nice within an existing react project. But, you should be able to use the debugger with no issues. There are a couple HTML overlays interfering with the top of the debugger. I just using my HTML console explorer to delete them, but if you need me to make them go away for the purpose of testing, I can.
Please let me know your thoughts and THANK YOU for your time and everything else you guys do.
You are setting the performance priority mode to Intermediate in the 6.1 link. The problem is that this mode sets alwaysSelectAsActiveMesh = true for all meshes, which is counter-productive in your case because you have many meshes.
If you want to keep this mode, you should reset alwaysSelectAsActiveMesh to false after you create a mesh.
Ok, so… yes… eliminating setting performance mode (my mistake) closed the gap… but not completely. There is still about 300 more draw calls and a lot more (millions) active indices and faces from one version to another. The active meshes, however, are exactly the same.
I have updated the live BJS 6 version… now BJS 6.2.0.
You should really make sure you use the exact same sources in both cases, and that only the BJS version changes…
In the 5.71 link, the second light is a point light, whereas in 6.2 it is a directional light with a shadow generator => it is the generation of the shadows which accounts for the 300+ additional draw calls.
That is so odd. This is literally running the exact same source code. The thing that changes from the two deploys is the version of BJS being used. Everything else is loaded dynamically from the exact same database and object store. I do see a couple other differences now, too. It’s like the models load in differently from one version to the next. I am even seeing a height difference in one of the models.
I am investigating. @Evgeni_Popov thanks for the bump in the right direction.