Re: Optimized smart strings
| From: | Derick Rethans | Date: | Mon, 20 Jun 2011 11:01:43 +0000 |
| Subject: | Re: Optimized smart strings | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53378@lists.php.net to get a copy of this message | ||
On Mon, 20 Jun 2011, Robert Eisele wrote:
> PHP makes use of the smart string library. I've optimized the
> smart_str_append_long() macro in order to save one division per cycle. At
> the moment one modulo and one division is used. The optimized version uses
> one division (which gets optimized away in most situations) and one
> additional multiplication + subtraction. I've additionally added also a new
> maco called smart_str_append_const(). This macro is used to append constant
> strings with a sizeof()-1 instead of strlen() "call". I'd be glad to see
> this change in 5.4.
>
> As I wrote in the earlier post, I'll deliver the patch in addition.
>
> PS: yes, this is a really small micro optimization.
It is, but it is not going to break anything, so IMO a good idea to add.
It would be awesome if we could document the whole smart_string API as
well though; even though it's fairly simple, moar documentation is good!
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug