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.
We are executing a loop for every input form element and the result is unused when the form is not submitted.
If the benchmarks show some speedup, then I recommend this for 4.7 too as there is no API change at all, we do not pass $edit
to anything and do not its value when $post is FALSE.
Comment | File | Size | Author |
---|---|---|---|
#5 | formspeedup_0.patch | 1.09 KB | chx |
formspeedup.patch | 878 bytes | chx | |
Comments
Comment #1
chx CreditAttribution: chx commentedPs. If you find it strange to assign a variable in a conditional, just think of it -- we do it for every database fetch, like
while ($node = db_fetch_object($result))
.Comment #2
drummIt appears that $posted is only used a little further down as the condition of an if statment and $edit is only used inside that block. Could we remove $posted and move all the logic to the second if statment?
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedworks as designed. code looks good.
Comment #4
moshe weitzman CreditAttribution: moshe weitzman commentedoops. missed drumm's remark
Comment #5
chx CreditAttribution: chx commentedNew version per drumm's remark.
Comment #6
drewish CreditAttribution: drewish commented+1, looks good and works for me.
Comment #7
drewish CreditAttribution: drewish commentedmoshe, gave it a +1 over IRC.
Comment #8
drummCommitted to HEAD.
Comment #9
(not verified) CreditAttribution: commented