Repository navigation
Conversation
VirtualTilesController.generate yielded the thread with setTimeout(0) about twenty times per model so progress and ABORT_MODEL messages get through. Browsers clamp nested timers to 4 ms, so every load waited 60-80 ms even when generating took a millisecond. The editor pays this on every geometry edit, because each edit loads a new delta model. Yield once at the first step (so a load can still be aborted before it generates, e.g. a single-threaded model disposed right after its constructor; a first timer is not clamped) and then only after 16 ms of work. Progress is still reported and aborts are still checked at every step. Measured in an app that continues a cable route on a federated project (4 models, ~1300 unsaved requests): delta model setup went from 100-140 ms to 37-50 ms per edit.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
VirtualTilesController.generateyields the thread withsetTimeout(0)everysampleAmount / 20samples, so progress andABORT_MODELmessages get through during a load. That is about twenty timers per model, whatever its size. Browsers clamp nested timers to at least 4 ms once they are nested more than five levels deep (each yield is set from the continuation of the previous one), so every load waits roughly 60–80 ms even when generating its tiles takes a millisecond.The editor pays this on every geometry edit:
EditHelper.editloads a new delta model (load→_setup→CREATE_MODEL→setupData→generate), usually a model of a few items.Change
single-threading/index.test.tscovers that). A first timer is not clamped.throwIfAbortedis still checked at every step, so large models keep yielding regularly and aborts land at the same steps.Measurements
An app that draws cable trays with the editor on a federated project, headless Chromium, the same machine before and after. Four models were loaded (about 3 M triangles); the edited model has 176 items and roughly 120 unsaved requests per drawn segment. Each step is one render-affecting
edit()plus one data-onlyedit()._setupedit()callsInitial loads of ordinary models save the same fixed 60–80 ms each.
Tests
virtual-tiles-yield.test.tsloadsschool_arq.fragthroughVirtualFragmentsModel.setupData:The full
packages/fragmentssuite passes (145 tests).