If tests happen to pass then I will bench this. By the use of the (known to be very fast) array_pop function and [] operator, I have implemented a simple stack to remove the recurse from drupal_render.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

For easier review, I attached a patch without the whitespace changes.

sun’s picture

chx’s picture

Added lots of comments and a missing reference in the for header.

Status: Needs review » Needs work

The last submitted patch failed testing.

sun’s picture

Status: Needs work » Needs review
Issue tags: +Performance, +D7 API clean-up

.

chx’s picture

Replaced the ugly for loop with a much nicer do.

chx’s picture

Status: Needs review » Needs work
Issue tags: +Performance, +D7 API clean-up

Oh well. I presume we need an output stack too.

sun’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
8.59 KB

Note that #601806: drupal_render() should not set default element properties when #type is not known contains some further optimizations to drupal_render() is about to be committed. (boils down to: skipping empty elements and not setting any global defaults)

--

Playing around with this, I think it is more complex than it needs to be.

If you disagree, then at least take over the comments. ;)

Status: Needs review » Needs work

The last submitted patch failed testing.

Crell’s picture

Subscribing.

chx’s picture

Sun, your approach is even more broken than mine :) I will take the comments, thanks.

chx’s picture

Assigned: chx » Unassigned
Issue summary: View changes
gisle’s picture

Official tag is "API clean-up" - https://www.drupal.org/node/1207020