-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Labels
Milestone
Description
When starting with a small scene and then programmatically adding a few hundred model tags with remote assets cause the UI to block sporadically during the loading phase of those (pure XML) assets.
This is probably caused by computationally heavy callbacks (after XHR response) blocking the UI thread for the length of several frames. This breaks the user experience when continuously interacting with the scene from the beginning.
This might be solved by a two step approach:
- minimize computational effort within XHR callbacks
- add a global task queue to resource manager
- when XHR returns, the callback just adds a new task to this queue
- in each frame, a small number of tasks is taken from the queue and actually executed
- perform actual computation asynchronously using other than UI thread
- instead of executing the tasks in each frame yourself, manage a pool of workers that
- picks regularly a task from the queue
- and executes each task without affecting the UI thread