Make drupal_render iterative

chx - November 8, 2009 - 21:01
Project:Drupal
Version:7.x-dev
Component:base system
Category:task
Priority:normal
Assigned:chx
Status:needs work
Issue tags:D7 API clean-up, Performance
Description

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.

AttachmentSizeStatusTest resultOperations
drupal_render_flatten.patch8.46 KBIdleFailed: Failed to install HEAD.View details | Re-test

#1

chx - November 8, 2009 - 21:03

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

AttachmentSizeStatusTest resultOperations
drupal_render_flatten_review.txt2.35 KBIgnoredNoneNone

#2

sun - November 8, 2009 - 21:10

#3

chx - November 8, 2009 - 21:18

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

AttachmentSizeStatusTest resultOperations
drupal_render_flatten.patch9.08 KBIdleFailed: Failed to install HEAD.View details | Re-test
drupal_render_flatten_review.txt2.97 KBIgnoredNoneNone

#4

System Message - November 8, 2009 - 21:30
Status:needs review» needs work

The last submitted patch failed testing.

#5

sun - November 8, 2009 - 21:34
Status:needs work» needs review

.

#6

chx - November 8, 2009 - 21:38

Replaced the ugly for loop with a much nicer do.

AttachmentSizeStatusTest resultOperations
drupal_render_flatten_review.txt2.71 KBIgnoredNoneNone
drupal_render_flatten.patch8.82 KBIdleFailed: Failed to install HEAD.View details | Re-test

#7

chx - November 8, 2009 - 21:39
Status:needs review» needs work

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

#8

sun - November 8, 2009 - 23:37
Status:needs work» needs review

#9

System Message - November 8, 2009 - 23:50
Status:needs review» needs work

The last submitted patch failed testing.

#10

sun - November 9, 2009 - 00:22
Status:needs work» needs review

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. ;)

AttachmentSizeStatusTest resultOperations
drupal.render-ref.9.patch8.59 KBIdleFailed: Failed to install HEAD.View details | Re-test

#11

System Message - November 9, 2009 - 00:40
Status:needs review» needs work

The last submitted patch failed testing.

#12

Crell - November 9, 2009 - 04:49

Subscribing.

#13

chx - November 9, 2009 - 06:20

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

 
 

Drupal is a registered trademark of Dries Buytaert.