From: Nick Mathewson Date: Fri, 26 Mar 2010 18:30:14 +0000 (-0400) Subject: Increase MIN_BUFFER_SIZE to 512 (1024 on 64-bit) X-Git-Tag: release-2.0.5-beta~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2014ae4ac630d727f23ca91dad5d0ebf56b694de;p=libevent Increase MIN_BUFFER_SIZE to 512 (1024 on 64-bit) This constant decides the smallest (and typical) size of each evbuffer chain. Since this number includes sizeof(evbuffer_chain) overhead, the old value (256) was just too low: on 64-bit platforms, it would spend nearly 20% of the allocations on overhead. The new values mean that we'll be spending closer to 5% of evbuffer allocations on overhead. It would be nice to get this number even lower if we can. --- diff --git a/evbuffer-internal.h b/evbuffer-internal.h index e8555dbd..ce1c347d 100644 --- a/evbuffer-internal.h +++ b/evbuffer-internal.h @@ -45,8 +45,15 @@ extern "C" { #include #endif #include -/* minimum allocation for a chain. */ -#define MIN_BUFFER_SIZE 256 + +/* Minimum allocation for a chain. We define this so that we're burning no + * more than 5% of each allocation on overhead. It would be nice to lose even + * less space, though. */ +#if _EVENT_SIZEOF_VOID_P < 8 +#define MIN_BUFFER_SIZE 512 +#else +#define MIN_BUFFER_SIZE 1024 +#endif /** A single evbuffer callback for an evbuffer. This function will be invoked * when bytes are added to or removed from the evbuffer. */