diff --git a/delphi/TESTMAIN.PAS b/delphi/TESTMAIN.PAS index 1f35e13..65e6ecb 100644 --- a/delphi/TESTMAIN.PAS +++ b/delphi/TESTMAIN.PAS @@ -165,13 +165,18 @@ end; procedure TMainForm.Run; +const + RenderMs = 50; { Minimum ms between renders during bulk flow (20 fps) } var - Msg: TMsg; - S: string; - HasData: Boolean; + Msg: TMsg; + S: string; + HasData: Boolean; + Now: Longint; + LastRenderTick: Longint; begin Show; - FDone := False; + FDone := False; + LastRenderTick := GetTickCount; while not FDone do begin { Process all pending Windows messages (keyboard, paint, scrollbar) } @@ -218,9 +223,16 @@ begin if FDone then Break; - { Tick blink (dirties rows if interval elapsed), then render } - FAnsi.TickBlink; - FAnsi.FlipToScreen; + { Render throttle: during bulk data flow, only render every RenderMs } + { to decouple parse throughput from GDI overhead. When idle, render } + { immediately for interactive responsiveness. } + Now := GetTickCount; + if (not HasData) or (Now - LastRenderTick >= RenderMs) then + begin + FAnsi.TickBlink; + FAnsi.FlipToScreen; + LastRenderTick := Now; + end; { Yield CPU to other apps when no serial data is flowing. } { PM_NOYIELD keeps message draining fast; Yield here gives other }