a3149eef03
In the browser a frame rasterises on the thread that parses output, so a stream drawn at 60 frames a second spends half its time drawing. With deferShows (the web default) output written less than a gap after the last show is shown when the gap has passed; output after a quiet spell (an echo) still shows at once. Natively frames rasterise on their own thread and written output keeps showing at once. The stream bench measures the stream without its final 600 ms wait for frame timings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
812 B
Dart
16 lines
812 B
Dart
import 'chat_shell_terminal_yield_stub.dart'
|
|
if (dart.library.js_interop) 'chat_shell_terminal_yield_web.dart'
|
|
as impl;
|
|
|
|
/// Runs [callback] in a later turn of the event loop, after which the UI
|
|
/// may have drawn a frame; the returned function cancels it if it has not
|
|
/// run. On the web this is a message task: a chain of zero-length timers
|
|
/// is clamped to 4 ms each after a few, which left the emulator idle for
|
|
/// a third of a large burst. Elsewhere it is a zero-length timer.
|
|
void Function() chatShellYield(void Function() callback) =>
|
|
impl.chatShellYield(callback);
|
|
|
|
/// Whether frames rasterise on the thread that parses output (the web),
|
|
/// so that drawing fewer of them while output streams lets it parse more.
|
|
const bool chatShellRasterSharesThread = impl.chatShellRasterSharesThread;
|