Loading time performance regression?

There seems to be something in babylon 5 causing it to take very long to load and instanciate.

Here are some test models which show the problem.


Compared to loading the same model in three.js, it takes a far bit longer.

Babylon 4.2

I have also compared the loading times with babylon 4.2 and they are also faster then v5.

Has anyone else experienced longer load times?

@bghgary could you have a quick look ?

I can repro. Will investigate.

What did you find?

I’m still working on it. Stay tuned.

We have the fix!!!

Will send a PR sooooon

Here we are!
Fix scene is ready by deltakosh · Pull Request #12214 · BabylonJS/Babylon.js (github.com)

Thanks for looking at it so fast :rocket:


@Deltakosh I am still experiencing really slow load times in babylon 5.4

I have multiple colleagues and clients that are reporting it to since our upgrade to v5

For me the Three.js viewer loads the scene and draws the first frame in about 2 seconds

But Babylon takes 8.5 seconds.

Could you please take a look again and see if you can find what is causing it?

If you try these links below, which should load a test model in both the sandbox and the donmccurdy gltf viewer.



Also @Leon is it still a regression from 4.2 ? mainly to help us dissect it

One aspect of the 3js viewer is that they render immediately where we are waiting for everything to be compiled to avoid pop out effects.

Babylonj.js sandbox is ready to render pretty quickly but we wait for the shaders to be compiled, for the environment to be loaded and ready and so on… So it is complicated to compare both experiences out of the box

@bghgary and @sebavan will dig more into your model anyway to be sure

Ideally we would need a repro of how it was before (4.2) and how it is now (5.0)

@sebavan: You did have one for this case right?

Ok found it!

@Leon: You can see with this PG (by switching between 4.2 and 5.4) that 5.4 is not slower (on my compute here); Babylon.js Playground (babylonjs.com)

5.4: (first pixel after 1.7s and gltf loaded after 1s)

4.2: (first pixel after 1.7s and gltf loaded after 1s)

@Leon What browser and OS are you using?

1 Like

Thanks for the playground.
This is very interesting.

I’m running a iMac pro from 2017
on MacOS monterey 12.3.1
on Chrome 101

Babylon.js v4.2.1 - WebGL2 - Parallel shader compilation
time1: 1.399999976158142
time2: 1603.3999999761581
time3: 4342.100000023842

Babylon.js v5.4.0 - WebGL2 - Parallel shader compilation
time1: 1.699999988079071
time2: 1335.199999988079
time3: 6888.199999988079

There is both a large gap between your times and mine, but also between 4.2 and 5.

Just to make sure it wasn’t chrome that was causing the problems I ran it in safari 15.4 also with the following results:

Babylon.js v4.2.1 - WebGL2 - Parallel shader compilation
time1: 1000
time2: 1601
time3: 4805

Babylon.js v5.4.0 - WebGL2 - Parallel shader compilation
time1: 2001
time2: 2149
time3: 6435

I had some colleagues do run the tests also just to see the difference between windows an mac

Older laptop i7 2ghz, 16gb ram
Windows 10, chrome 101

Babylon v4.2.1
time1: 1.799
time2: 1881
time3: 5199

Babylon 5.4.0
time1: 4.700
time2: 3723
time3: 12057

New 3D rig with good perf
Windows 11, chrome 101

Babylon v4.2.1
time1: 1.200
time2: 843
time3: 2133

Babylon v5.4.0
time1: 1.300
time2: 1051
time3: 2457

Could it have something to do with parallel shader compilation and how it allocates resources, maybe it doesn’t work correctly on mac or ios?