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
Requests are still handled on the UI thread, but with the integration of the Fetch API they're now queued and processed between frames. This should improve the interactivity of the scene during loading.
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: