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.
This commit is contained in:
Nick Mathewson 2010-03-26 14:30:14 -04:00
parent 6f20492fa2
commit 2014ae4ac6

View File

@ -45,8 +45,15 @@ extern "C" {
#include <winsock2.h>
#endif
#include <sys/queue.h>
/* 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. */