Fine tune the artificial delays in the render loop

There are now two numbers, repaint_delay and input_delay
that control how often the screen is repainted and how frequently
input received from the child process is processed.

This halves the CPU usage in intensive cases such as scrolling
a file in less. The CPU usage of kitty + X when scrolling is now
significantly lower than all the other terminals on my system.

MROAWR!

...
This commit is contained in:
Kovid Goyal
2017-09-16 08:20:23 +05:30
parent 43ebddc28f
commit 728f33700a
8 changed files with 56 additions and 47 deletions
+1 -1
View File
@@ -251,6 +251,7 @@ typedef struct {
unsigned int parser_state, parser_text_start, parser_buf_pos;
bool parser_has_pending_text;
uint8_t read_buf[READ_BUF_SZ], *write_buf;
double new_input_at;
size_t read_buf_sz, write_buf_sz, write_buf_used;
pthread_mutex_t read_buf_lock, write_buf_lock;
@@ -267,7 +268,6 @@ typedef struct {
PyObject_HEAD
PyObject *dump_callback, *update_screen, *death_notify;
double repaint_delay;
unsigned int count;
bool shutting_down;
pthread_t io_thread;