[wp-trac] [WordPress Trac] #31950: Reduce PHP memory usage / No unnecessary concatenation

WordPress Trac noreply at wordpress.org
Thu Jul 2 14:05:11 UTC 2015


#31950: Reduce PHP memory usage / No unnecessary concatenation
-----------------------------------+------------------------------
 Reporter:  jrf                    |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  General                |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:  performance
-----------------------------------+------------------------------

Comment (by dd32):

 Using comma's should be faster, simply due to the fact that PHP doesn't
 need to merge the strings in memory before it uses it, technically it
 should be able to just add them straight to the output buffer. In reality
 I think it's an extreme micro-optimization that benefits WordPress very
 little. It might be able to shave 0.01ms off a page load if someone was
 lucky.. they'll get a better speed increase by upgrading their PHP
 version.

 I also really question how much impact this change will have in PHP 7,
 simply due to the sheer amount of optimizations that have been done over
 time. The articles above are from 2007/2010, and it was a tiny
 optimization back then (they used 1million/4million iterations to get a
 ~140ms speed increase)

 Should also be mentioned, using 3v4l for benchmarks should also be
 avoided, not only is it abusive, but the performance characteristics are
 not guaranteed - some of the PHP 5.3 runs matched the PHP7 runs in speed.

 Finally.. the concatenation operator is also a far more well known and
 obvious operator to many, and with the miniscule speed & memory difference
 it makes it doesn't seem like a micro-optimization we should make IMHO.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31950#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list