Babylon.js: glTF loader is slow on assets with lots of nodes

Created on 12 Dec 2019  路  2Comments  路  Source: BabylonJS/Babylon.js

See twitter thread: https://twitter.com/deltakosh/status/1204891228195545088

Asset is not shared here as it's not public here: https://github.com/BabylonJS/Babylon.js/issues/7312#issuecomment-564789519

There are a couple of issues that causes the slowness.

  • [x] The glTF validator runs synchronously on the same thread as the main JavaScript thread. The validation of buffer(s) runs on separate tick(s) after the initial synchronous call to validate the JSON payload. The best solution for this is to run glTF validator on a web worker if that's possible.

  • [x] After profiling, it appears calls to Promise functions (e.g. Promise.all, Promise.then) are expensive. If there are only a few, it's not too bad, but because this asset has so many nodes, the problem is multiplied. The glTF loader heavily uses promises and it will be an interesting challenge to stop using them. Turns out this is a fluke because I profiled with vscode Chrome debugger enabled.

  • [x] _getGeoemetryByUniqueID is slow. There is an option on the scene to make it fast. Will figure out what to do here.

enhancement loaders optimizations

Most helpful comment

@bghgary the model I emailed can be made public. I'll upload it here to keep it with the issue.
conference.glb.zip

All 2 comments

@bghgary the model I emailed can be made public. I'll upload it here to keep it with the issue.
conference.glb.zip

Turns out the promise issue is a fluke. I was profiling with the vscode Chrome debugger which was causing the slowness.

There is a second issue (unique id map for the add geometries) that is also causing some slowness that I will fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dad72 picture dad72  路  35Comments

nbduke picture nbduke  路  21Comments

deltakosh picture deltakosh  路  23Comments

azchatlanin picture azchatlanin  路  17Comments

innerground picture innerground  路  59Comments