Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I was noticing an extra array_shift()
in the newly updated conf_init()
function and I did a google search for performance differences and found this: http://webdevlogs.com/2007/05/11/array-shift-is-slower-than-i-thought
I will do a code search for other instances of array_shift()
and provide a patch later.
Comment | File | Size | Author |
---|---|---|---|
#4 | less_array_shift_1.patch | 2.62 KB | chx |
#2 | less_array_shift_0.patch | 16.21 KB | chx |
#1 | less_array_shift.patch | 16.19 KB | chx |
Comments
Comment #1
chx CreditAttribution: chx commentedfixed cache problems with PostgreSQL and yet, MySQL performance suffers ever since. I removed array_shift and preg_replace_callback from db_query for mysql. Also removed from bootstrap and module inc -- the critical path (ie. the code ran to serve a cached page) now does not have array_shift.
Comment #2
chx CreditAttribution: chx commentedLet's try this version, which happens to work somewhat unlike the above :)
Comment #3
chx CreditAttribution: chx commentedNaturally, more patches will be needed to remove 'em all.
Comment #4
chx CreditAttribution: chx commentedI can't load webdevlogs but the google cache of the original post still exists. I now simplified the patch to just removing array_shifts from bootstrap and module.
Comment #5
kevin francis CreditAttribution: kevin francis commentedTested chx's patch by creating several nodes of page and story types and it works without problems.
Comment #6
Wim LeersRTBC
Comment #7
Gábor HojtsyIt would be great to see that blog post before doing a commit on this.
Comment #8
chx CreditAttribution: chx commentedknock, knock. Is this thing on? Um. Anyone reads what I type? I doubt. Care to reread #4 ?
Comment #9
dvessel CreditAttribution: dvessel commentedtested, works here too.
Maybe a follow up patch is in order. theme() uses it and it's iterated quite often.
Comment #10
Gábor HojtsyOK, read up on the google cached text. Admittedly, it looks like we are better avoiding array_shift(), although I doubt much of this would show a difference in a benchmark. Nobody said he tried to benchmark.
Anyway, it saves us some cycles, and I don't think the code becomes any significantly unreadable, so committed.
Comment #11
(not verified) CreditAttribution: commented