git » nmdb » commit 2ac34c9

Reduce tipc_recv()'s buffer size.

author Alberto Bertogli
2007-05-12 03:11:24 UTC
committer Alberto Bertogli
2007-05-12 03:11:24 UTC
parent 1b42da5deb504cde421728f1872de0a30d246a8e

Reduce tipc_recv()'s buffer size.

There is a small but noticeable performance gain if we reduce the
tipc_recv()'s buffer size from 128k to 68k. Since the maximum TIPC packet
size is 66000 bytes, this should be enough for even the biggest packets.

Making the buffer static and outside the function was tested but it
performed worse than the current stack-based one.

It's still ugly, but at least it uses almost half the stack size.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

nmdb/tipc.c +2 -2

diff --git a/nmdb/tipc.c b/nmdb/tipc.c
index f6f6e3c..b4735ba 100644
--- a/nmdb/tipc.c
+++ b/nmdb/tipc.c
@@ -288,8 +288,8 @@ void tipc_recv(int fd, short event, void *arg)
 	 * operations.
 	 * TODO: check for negative impacts (beside being ugly, obviously)
 	 */
-	unsigned char buf[128 * 1024];
-	bsize = 128 * 1024;
+	unsigned char buf[68 * 1024];
+	bsize = 68 * 1024;
 
 	clilen = sizeof(clisa);