Text laggy when simulating typing in Python repls

hey sorry for being a lil late to the conversation, but a big reason is that it’s just how it works. What programming languages do is that they store your current output to a buffer string which will print out once it reaches a certain length because printing something is a very costly operation and doing it so often by forcing it to flush (print out the buffer at only one character) is just supremely inefficient and having only a 0.04 second latency makes it lag. After this, when the user inputs something, it gives the console a bit of a break from the constant processing, that is likely where the lag is from.
Possible other causes I can think of:

  1. printing unicode could be costly/laggy
  2. inputting has some sort of buffer optimization to handle the user constantly inputting keybinds and printing out single chars without a buffer, and therefore once you run input the optimization helps your repl to run better.

:smiley:

1 Like