# Loading time performance regression?

**URL:** <https://forum.babylonjs.com/t/loading-time-performance-regression/28504>\
**Category:** Bugs\
**Tags:** gltf\
**Created:** [March 17, 2022, 12:56pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504 "2022-03-17T12:56:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/leon/32/30387_2.png) [@Leon](https://forum.babylonjs.com/u/Leon)\
**Post date:** [March 17, 2022, 12:56pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/1 "2022-03-17T12:56:16Z")

</div>

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.

> **[Babylon.js Sandbox - View glTF, glb, obj and babylon files](https://sandbox.babylonjs.com/?assetUrl=https:%2F%2Fcdn.wec360.com%2Fdemo%2Fvisualization-bundle-premium%2Fviews%2Fwebgl-exterior%2FX3w1KXnY@model.glb)**
>
> Viewer for glTF, glb, obj and babylon files powered by Babylon.js

> **[Babylon.js Sandbox - View glTF, glb, obj and babylon files](https://sandbox.babylonjs.com/?assetUrl=https:%2F%2Fcdn.wec360.com%2Fdemo%2Fvisualization-bundle-premium%2Fviews%2Finterior-view%2FDnYRoVYi@model.glb)**
>
> Viewer for glTF, glb, obj and babylon files powered by Babylon.js

# ThreeJS

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

> **[glTF Viewer](https://gltf-viewer.donmccurdy.com/#model=https://cdn.wec360.com/demo/visualization-bundle-premium/views/webgl-exterior/X3w1KXnY%40model.glb)**
>
> Drag-and-drop preview tool for glTF 2.0 3D models.

> **[glTF Viewer](https://gltf-viewer.donmccurdy.com/#model=https://cdn.wec360.com/demo/visualization-bundle-premium/views/interior-view/DnYRoVYi%40model.glb)**
>
> Drag-and-drop preview tool for glTF 2.0 3D models.

# 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?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 17, 2022, 4:26pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/2 "2022-03-17T16:26:00Z")

</div>

Assigned @bghgary on March 17, 2022, 4:26pm UTC



---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 17, 2022, 4:26pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/3 "2022-03-17T16:26:32Z")

</div>

@bghgary could you have a quick look ?

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 17, 2022, 8:19pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/4 "2022-03-17T20:19:10Z")

</div>

I can repro. Will investigate.

---

<div class="post-metadata">

**Author:** ![Leon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/leon/32/30387_2.png) [@Leon](https://forum.babylonjs.com/u/Leon)\
**Post date:** [March 18, 2022, 1:31pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/5 "2022-03-18T13:31:07Z")

</div>

What did you find?

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 18, 2022, 4:01pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/6 "2022-03-18T16:01:38Z")

</div>

I’m still working on it. Stay tuned.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 19, 2022, 3:48am UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/7 "2022-03-19T03:48:17Z")

</div>

We have the fix!!!

Will send a PR sooooon

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 19, 2022, 4:11am UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/8 "2022-03-19T04:11:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Leon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/leon/32/30387_2.png) [@Leon](https://forum.babylonjs.com/u/Leon)\
**Post date:** [March 19, 2022, 2:34pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/9 "2022-03-19T14:34:03Z")

</div>

Awesome!  
Thanks for looking at it so fast 🚀

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 21, 2022, 3:49pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/10 "2022-03-21T15:49:21Z")

</div>

Unassigned @bghgary on March 21, 2022, 3:49pm UTC



---

<div class="post-metadata">

**Author:** ![Leon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/leon/32/30387_2.png) [@Leon](https://forum.babylonjs.com/u/Leon)\
**Post date:** [May 3, 2022, 6:48am UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/11 "2022-05-03T06:48:37Z")

</div>

@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.

```auto
https://sandbox.babylonjs.com/?assetUrl=https://cdn.wec360.com/demo/visualization-bundle-premium/views/webgl-exterior/X3w1KXnY@model.glb

https://gltf-viewer.donmccurdy.com/#model=https://cdn.wec360.com/demo/visualization-bundle-premium/views/webgl-exterior/X3w1KXnY%40model.glb

```

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 3, 2022, 3:06pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/12 "2022-05-03T15:06:54Z")

</div>

Assigned @bghgary on May 3, 2022, 3:06pm UTC



---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 3, 2022, 3:36pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/13 "2022-05-03T15:36:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [May 3, 2022, 4:50pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/14 "2022-05-03T16:50:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [May 3, 2022, 4:58pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/15 "2022-05-03T16:58:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [May 3, 2022, 5:23pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/16 "2022-05-03T17:23:29Z")

</div>

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)](https://playground.babylonjs.com/#AX373J#5)

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

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/0/a/0aa210472998dd78809b879a82220279e13e2ad6.png)

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

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/4/64d830182f8ad19008225085df5ac0758d728d12.png)

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [May 3, 2022, 5:28pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/17 "2022-05-03T17:28:55Z")

</div>

@Leon What browser and OS are you using?

---

<div class="post-metadata">

**Author:** ![Leon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/leon/32/30387_2.png) [@Leon](https://forum.babylonjs.com/u/Leon)\
**Post date:** [May 4, 2022, 9:30am UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/18 "2022-05-04T09:30:13Z")

</div>

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.  
😅

---

<div class="post-metadata">

**Author:** ![Leon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/leon/32/30387_2.png) [@Leon](https://forum.babylonjs.com/u/Leon)\
**Post date:** [May 4, 2022, 11:23am UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/19 "2022-05-04T11:23:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Leon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/leon/32/30387_2.png) [@Leon](https://forum.babylonjs.com/u/Leon)\
**Post date:** [May 4, 2022, 1:00pm UTC](https://forum.babylonjs.com/t/loading-time-performance-regression/28504/20 "2022-05-04T13:00:01Z")

</div>

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?

[Next page](https://forum.babylonjs.com/t/loading-time-performance-regression/28504.md?page=2)
