From 186b8439ae9a7bb5178ca604571e2ed2f4edbfdf Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Mon, 13 Mar 2017 09:40:33 +0000 Subject: [PATCH] reds-stream: Small syscall optimisation Handle single chunk writev as normal write. From some test more than 60% of the times writev is called with 1 as counter. We can easily and very cheaply turn this call to a simpler write avoiding the need to pass the array to the kernel. Signed-off-by: Frediano Ziglio Acked-by: Christophe Fergeau --- server/reds-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/reds-stream.c b/server/reds-stream.c index 8ac296d2..77f9424d 100644 --- a/server/reds-stream.c +++ b/server/reds-stream.c @@ -308,7 +308,7 @@ ssize_t reds_stream_writev(RedsStream *s, const struct iovec *iov, int iovcnt) int n; ssize_t ret = 0; - if (s->priv->writev != NULL) { + if (s->priv->writev != NULL && iovcnt > 1) { return s->priv->writev(s, iov, iovcnt); }