Re: [PATCH] Some string changes/optimizations
| From: | Matt Wilmas | Date: | Wed, 07 May 2008 14:50:51 +0000 |
| Subject: | Re: [PATCH] Some string changes/optimizations | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37513@lists.php.net to get a copy of this message | ||
Hi Felipe,
I don't know. :-/ That's a pretty big discrepancy... (Did you do a
complete recompile before and after the patch?) With your test, timed with
microtime() on my old Win2k system (release/non-debug), I get 1.56s before
and 1.54s after -- about what I'd expect after doing my own random testing
previously. It's not expected to be a big optimization, just eliminate the
overhead of the old INIT_STRING only allocating an empty string initially.
(Of course, the more ADD_STRING/ADD_VAR ops for a string, the less relative
difference there is.) And saving an opcode makes creating/destroying op
arrays just a bit faster without a cache.
BTW, after recompiling the latest 5.3 code, after some changes in the last
days (mine had been a few days old), I observed a couple different things
after my changes: the binary size was 8K smaller (no change a few days ago),
and there was a surprising improvement on a lot of the bench.php tests (I
think "ackermann" is the only one that uses interpolated strings). Just
compiler randomness I guess, but going from 27.9s to 27.1s is more than the
fluctuation I've seen before. :-)
- Matt
----- Original Message -----
From: "Felipe Pena"
Sent: Tuesday, May 06, 2008
> Hi Matt,
> about optimization..., do you have any test for comparison? Why, in my
> crazy test (http://rafb.net/p/ZzQQQP97.html), the actual code is more
> faster than your patch.
>
> real 0m1.156s
> vs
> real 0m1.368s
>
> (using time command)
>
>
> I'm just curious, i'm not against your patch.
>
> Thanks.
> --
> Regards,
> Felipe Pena.