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.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to