On Friday, 5 June 2020 at 20:05:28 UTC, aberba wrote:
Why was the initial decision to handle buffering that way in terminal?
More buffering = more speed, it actually makes a surprisingly big difference sometimes, like you can notice the lag with your eyes alone as it prints in the more extreme cases, seeing the cursor bounce around the screen and such when doing a full screen update.
So I have it internally gathering everything together into one big buffer, all your moveTo, color, and writeln calls gather it. Then the flush updates as much of the screen as possible in one go.
Since it auto-flushes when you get input or when the program exits, it works pretty well a lot of the time... but when you are like "working..." then the program pauses, it doesn't help at all.
If I was doing it again today, I think I'd probably make it flush a little more often automatically, at least with the linear output mode.