Batch serial reads before rendering to improve ANSI throughput
Drain all available serial data before calling FlipToScreen so overlapping screen changes collapse into a single GDI render pass. Messages are checked between chunks to keep keyboard responsive. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c8ccedf569
commit
02e01848d6
1 changed files with 19 additions and 2 deletions
|
|
@ -189,18 +189,35 @@ begin
|
|||
if FDone then
|
||||
Break;
|
||||
|
||||
{ Poll serial data -- read one chunk per iteration }
|
||||
{ Drain all available serial data before rendering. Batching }
|
||||
{ many chunks into one render pass avoids per-chunk GDI overhead. }
|
||||
{ Messages are checked between chunks so keyboard stays responsive.}
|
||||
HasData := False;
|
||||
if FComm.PortOpen then
|
||||
begin
|
||||
S := FComm.Input;
|
||||
if Length(S) > 0 then
|
||||
while (Length(S) > 0) and not FDone do
|
||||
begin
|
||||
FAnsi.WriteDeferred(S);
|
||||
HasData := True;
|
||||
{ Check for messages between chunks }
|
||||
while PeekMessage(Msg, 0, 0, 0, pm_Remove or pm_NoYield) do
|
||||
begin
|
||||
if Msg.message = wm_Quit then
|
||||
begin
|
||||
FDone := True;
|
||||
Break;
|
||||
end;
|
||||
TranslateMessage(Msg);
|
||||
DispatchMessage(Msg);
|
||||
end;
|
||||
S := FComm.Input;
|
||||
end;
|
||||
end;
|
||||
|
||||
if FDone then
|
||||
Break;
|
||||
|
||||
{ Tick blink (dirties rows if interval elapsed), then render }
|
||||
FAnsi.TickBlink;
|
||||
FAnsi.FlipToScreen;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue