Are you are trying to say that with once loaded, compiled and cached code there would be a difference between single and double quotes?
And also you are saying that two functions which are both aliases to the same zend engine function there will be difference after compilation, especially when using Zend Accelerator or eAccelerator or XCache?
And, most notably, do you really mean that all this stuff would relly matter with complex code and lots of IMAP and MySQL interaction?
Premature optimization is the root of all evil. Do you have any benchmarks? Did you profile the code and actually saw that concatenating stings takes at least 10% of running imap_open?
В Thu, 2 Jul 2009 21:38:43 +0200 darklight darklight.xdarklight@googlemail.com пишет:
Hi,
walking through roundcube's code I've found some room for small improvements. if you sum them all together you may get some nice performance improvement (not very huge - but you can probably notice it)
what I'm talking of are mainly style questions... because there are functions in php that do the same as another function, with the small difference that function X is faster
for example print() is slower than echo() also double-quotes (") are up to 25% slower than concatenating strings with single quotes (') - which is a HUGE performance boost
I've found a site which lists some of those functions - check [1] I quickly compared the list with roundcube's codebase those are the main places where there is still room for improvement:
- use ' instead of " (where possible - for example 'this is a test' .
"\n" would still be faster than "this is a test\n" - but you cannot replace '"\n" by '\n')
- multiple parameters for echo - but most people prefer concatenating over this multiple argument feature (I have to admit: I also prefer string concatenation)
- pre-increment instead of post-increment (should be quite easy to do
this, since you need post-increment only in very few cases)
- unset() should be used more often (bigger task)
- use require() instead of require_once() - this is probably a bigger
task too
one small note about [1]: afaik switch/case is faster than if/else that site says the opposite
some of those things can be put into roundcube's codebase quite easily maybe you can create some "Junior Jobs" section in your wiki, so bored devs may write patches (which of course should be reviewed by an experienced dev)
however, feel free to discuss this oh, and I know: this whole mail is not mean for today's development... but more something for the future
Regards, Martin
[1] http://progtuts.info/55/php-optimization-tips/ _______________________________________________ List info: http://lists.roundcube.net/dev/
List info: http://lists.roundcube.net/dev/