From 9d4cd66631336e2025f8b6314e75445ec0176cbb Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 30 Jan 2012 18:50:28 +0200 Subject: [PATCH] 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 Signed-off-by: David Herrmann --- src/pty.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pty.c b/src/pty.c index b72501e..043aeb1 100644 --- a/src/pty.c +++ b/src/pty.c @@ -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) {