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 <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
Frediano Ziglio 2017-03-13 09:40:33 +00:00
parent 7b5e294a36
commit 186b8439ae

View File

@ -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);
}