cvs: pecl /apc apc_sma.c
| From: | Rasmus Lerdorf | Date: | Sat, 25 Feb 2006 08:14:34 +0000 |
| Subject: | cvs: pecl /apc apc_sma.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-5266@lists.php.net to get a copy of this message | ||
rasmus Sat Feb 25 08:14:34 2006 UTC
Modified files:
/pecl/apc apc_sma.c
Log:
64 byte minimum chunks seems to work well and uses less memory
http://cvs.php.net/viewcvs.cgi/pecl/apc/apc_sma.c?r1=1.34&r2=1.35&diff_format=u
Index: pecl/apc/apc_sma.c
diff -u pecl/apc/apc_sma.c:1.34 pecl/apc/apc_sma.c:1.35
--- pecl/apc/apc_sma.c:1.34 Sat Feb 25 07:03:00 2006
+++ pecl/apc/apc_sma.c Sat Feb 25 08:14:34 2006
@@ -26,7 +26,7 @@
*/
-/* $Id: apc_sma.c,v 1.34 2006/02/25 07:03:00 rasmus Exp $ */
+/* $Id: apc_sma.c,v 1.35 2006/02/25 08:14:34 rasmus Exp $ */
#include "apc_sma.h"
#include "apc.h"
@@ -99,8 +99,8 @@
size_t realsize; /* actual size of block needed, including header */
size_t minsize; /* for finding best fit */
- if(size<128) {
- realsize = 128;
+ if(size < 0x40) {
+ realsize = 0x40;
} else {
/*
* Set realsize to the smallest power of 2 greater than or equal to
@@ -116,12 +116,12 @@
#endif
realsize = p + 1;
} else {
- /* Probably makes more sense to just round up to the next 128 byte boundary */
+ /* Probably makes more sense to just round up to the next 64 byte boundary */
size_t p = size - 1;
#if SIZEOF_INT == 8
- p&=0xffffffffffffff80; p+=0x80;
+ p&=0xffffffffffffffc0; p+=0x40;
#else
- p&=0xffffff80; p+=0x80;
+ p&=0xffffffc0; p+=0x40;
#endif
realsize = p;
}
@@ -168,7 +168,7 @@
/* update the block header */
header->avail -= realsize;
- if (cur->size == realsize || ((cur->size - realsize) < 128)) {
+ if (cur->size == realsize || ((cur->size - realsize) < 0x40)) {
/* cur is a perfect fit for realsize; just unlink it */
prv->next = cur->next;
}