Faster rendering of text and stderr outputs #141
Draft
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.
References
Fixes # 16957
Code changes
Makes the auto-linking logic execute asynchronously, at the speed matching the approximate refresh rate of standard monitors. Appends new nodes in the textual streams without removing the existing minimising layout computation cost.
requestAnimationFrame
.www.
and chunk two isexample.com
)\b
or\r
in the new chunkwww.example.com
in partially rendered text outputaaa www.example.com ccc
we are also implicitly destroying the selection. This also leads to an improvement to status quo where selection was being destroyed on each stream chunk being added.User-facing changes
It's faster
The output content is displayed when it gets returned from the kernel as soon as possible - no more choking the rendering pipeline due to too much output streamed at once.
The links show up with a delay
The links are displayed as soon as these are processed
Selection is fun again
Selection of outputs that is being streamed is not destroyed when new output arrives
Future work
Potential improvements:
requestAnimationFrame
and use it instead of a hard-coded time limit; this might improve the experience for users with high-refresh rate monitors also using high-frequency CPUsrequestAnimationFrame
(and cancelling it) we could call it once and update arguments if new chunk is streamed; this is because there is an overhead associated (approx 0.6s for each 10s so not terrible, but noticeable); instead we could pass state via aWeakMap
or similar.Backwards-incompatible changes
None