pty: increase input buffer size

Increase the buffer size to match the kernel's. This should guarantee
(practically) that we read() everything queued up for us.

This speeds us up considerably when running something like
$ find /
Such a process spends most of its time blocking on write() waiting for
us. By increasing the buffer size we avoid repeated
read pty -> draw screen -> read pty
cycles, which take most of our time.

To time it, before:
real  0m22.588s
user  0m00.000s
sys   0m00.020s

After:
real  0m00.680s
user  0m00.023s
sys   0m00.000s

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
Ran Benita 2012-01-30 18:50:28 +02:00 committed by David Herrmann
parent 9c97408910
commit 9d4cd66631

View File

@ -281,7 +281,8 @@ static int send_buf(struct kmscon_pty *pty)
return 0;
}
#define KMSCON_NREAD 128
/* Match N_TTY_BUF_SIZE from the kernel to read as much as we can. */
#define KMSCON_NREAD 4096
static void pty_input(struct kmscon_fd *fd, int mask, void *data)
{