Re: Fw: [PHP] PHP URL issues
| From: | Robert Cummings | Date: | Wed, 14 Mar 2007 15:49:37 +0000 |
| Subject: | Re: Fw: [PHP] PHP URL issues | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250585@lists.php.net to get a copy of this message | ||
On Wed, 2007-03-14 at 16:31 +0100, Satyam wrote:
> One more example of a questionable benchmark, not wrong but I wonder (as I
> was doing in my previous) whether it is really representative.
>
> There are two main ways to handle strings, one is to malloc exactly the
> required memory for each string and keep moving characters around from one
> chunk of memory to another. If you append a single character to a string,
> you would measure both, add their lengths plus whatever overhead your data
> representation requires, malloc that much memory, move the characters from
> each source and then free the memory occupied by the first.
>
> The other way to do it is to malloc memory in more or less fixed sizes and
> include in the header of your variable a length field.
You forgot realloc().
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'