We can easily remove most of the uses of array_shift() form menu.inc. As recent posts have noted, this is a very slow function because it requires re-indexing the whole array.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | menu_no_array_shift-172764-4.patch | 1.17 KB | chx |
| #3 | no_shift_menu_2.patch | 1.34 KB | pwolanin |
| no_shift_menu_1.patch | 1.22 KB | pwolanin |
Comments
Comment #1
chx commentedthis prints
barso I think the use ofnextmight not result in what we want.eachcould be, but then you need tolistas well. I am fairly sure that this pair of functions is still (much) faster though.Comment #2
pwolanin commentedAh, yes - stupid of me. I was confused by the PHP doc that says it works like current().
Comment #3
pwolanin commentedhow about this instead?
Comment #4
chx commentedAnd what do you think of this version?
Comment #5
pwolanin commentedlooks pretty good - though we don't even need the $key in the foreach
Comment #6
owahab commentedI think the existence of $key is good for readability.
Yet the code is RTBC IMHO.
Comment #7
gábor hojtsyLooks ok, committed.
Comment #8
(not verified) commented