Re: Smart strings & memory allocation

From: Date: Wed, 18 Jun 2003 13:06:56 +0000
Subject: Re: Smart strings & memory allocation
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-2362@lists.php.net to get a copy of this message
On Wed, 18 Jun 2003, Stanislav Malyshev wrote: > SS>> If you move the additional check (newlen < > SS>> SMART_STR_START_SIZE) and preallocation into the if (!(d)->c) > SS>> branch, the changes won't affect the common code path. > > IMO, the common code path is that of SMART_STR_START_SIZE, since as I > said 90% of strings never reach beyond initial alloc. But I see your > point, you are right, the START_SIZE one should be into if (!(d)->c) > branch. Common referred to real applications, not 'make test'. In fact, whenever strings are not allocated through the engine, 80 bytes is a really poor choice, because the malloc implementation will very likely allocate a 128 byte chunk anyway. - Sascha (who just yesterday ported FreeBSD's malloc.c for shared memory handling)

« previous php.internals (#2362) next »