[wp-trac] [WordPress Trac] #35025: Performance regression in comments_template in 4.4
WordPress Trac
noreply at wordpress.org
Sat Dec 12 05:59:25 UTC 2015
#35025: Performance regression in comments_template in 4.4
--------------------------+--------------------------
Reporter: rogerhub | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.4.1
Component: Comments | Version: 4.4
Severity: normal | Resolution:
Keywords: has-patch | Focuses: performance
--------------------------+--------------------------
Changes (by rogerhub):
* keywords: reporter-feedback => has-patch
Comment:
Hi, thanks for the quick response. I did some PHP profiling, and it looks
like the performance hit I was experiencing was because of the use of the
array_merge function. I looked on Google for "array_merge slow" and it
seems like a lot of people say that array_merge is slow and shouldn't be
used in loops. I rewrote the code with foreach/"$array[] =" and the
running time of the loop I mentioned in the OP went from 10~11 seconds to
0.3 seconds. I've attached a patch that fixes the issue for me. I've never
submitted a patch for WordPress before, so if there's something extra I
need to do or a code style issue, please let me know.
Thanks for your time!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35025#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list