Hi Stas, Can we see any difference with optimal ZEND_ADD_(STRING|CHAR|VAR)? :-) Well, multiple ADD_STRINGs are one thing that optimizers/accelerators would stitch back together, because it's a "major optimization." ;-) I didn't specifically mention it in my previous messages, but since these particular opcodes are now optimal, it's one step that those optimizers would no longer need to do.
I mentioned some performance figures in my original message, but here's a few again... Should be a pretty easy thing for anyone to benchmark. I was surprised by the difference using ApacheBench (no accelerator of course) on some different applications/scripts: 5-20% *overall* speedup, with 10-15% being typical. I'm curious whether others would find the same on their stuff?? When talking about the difference on specific code affected by the optimizations, let's look at the NO_PCRE_ERROR heredoc from run-tests.php which Sara referred to in her blog entry. The compile/cleanup time on that (tested by eval()'ing many in an if (0) { ... } block) is about 2.5 times faster. And because it's only a few opcodes now instead of 70-something, it runs *15 TIMES* faster! Now take a fairly short interpolated string, "This is $var string" ($var = 'some'), and its compile/cleanup and run times are about 40% and 60% faster, respectively (I think I previously measured 50% and 55%, so somewhere around there :-)). It all depends on how many "pieces" (opcodes) were created by the strings the old way and new way... But it's easy to test your own code, like I said. Finally, since any 1 character "pieces" that would've previously used ADD_STRING are now made to use ADD_CHAR (only certain things would before), that makes a measurable difference too. For example, with "$var." or "<$var>" I see a ~20% speedup. Hope that helps. :-) Matt ----- Original Message ----- From: "Stanislav Malyshev" Sent: Thursday, May 17, 2007 > > The patch mainly improves not the parser, but generated code. > > It builds near optimal ZEND_ADD_STRING, ZEND_ADD_VAR sequence for quoted > > strings and heredoc. > > OK, I understand that, the question is can we see any difference? We are > doing quite major overhaul of the parser, so there should be a reason > for it - like the code gets to be that and that faster, etc. Is there a > way to see it? > > > You can see a small difference even on Zend/bench.php. > > Actually I don't :) Not beyond the margin of error at least. I'm not > very surprised since bench.php doesn't do much with interpolated strings > as I see - but I would like to verify that this patch is really a "major > optimization" ;) > > -- > Stanislav Malyshev, Zend Products Engineer > [EMAIL PROTECTED] http://www.zend.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php