Coming from #639974-6: Speed up element_children() using array_multisort()
By optimizing this, I can cut over 300ms off of a drupal front page load on our test servers.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeytown2’s picture

Status: Active » Needs review
Issue tags: +Performance
FileSize
598 bytes
mikeytown2’s picture

Peter Bowey’s picture

Query: How does this patch measure up in light of the comments by sun?
See: http://drupal.org/node/639974#comment-3666548

mikeytown2’s picture

That comment was directed towards 7.x.
This patch flattens out element_children() by in-lining element_child(). Code wise they will always output the same; just element_child doesn't get called thousands of times now.

mikeytown2’s picture

Another round of optimizations to the code here :)

Stock:
Total Self: 92ms
Total Cumulative: 460ms
element_children() calls: 2,470

Patch #1:
Total Self: 67ms
Total Cumulative: 74ms
element_children() calls: 2,482

This Patch:
Total Self: 39ms
Total Cumulative: 39ms
element_children() calls: 2,482

fabsor’s picture

Status: Needs review » Reviewed & tested by the community

I tried this to, and I get an even better return from this, closer to about 800ms on a site with a lot of modules, including vertical tabs and node relationships. This is a pretty extreme example, but there are a lot of those out there.

This is completely unintrusive, so I don't see why we can't get this into core.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

1. Was this already applied to Drupal 7?
2. Can we get some inline documentation about what is going on there? The issue comments explain here what is being inlined, but the code might easy be cryptic after the commit to the uninitiated.

mikeytown2’s picture

Status: Needs work » Needs review
FileSize
779 bytes

element_children() in D7 vs D6 are miles apart from each other, but the call to element_child() has been inlined in the D7 code, so you can say this has already been applied to Drupal 7.

Updated patch to add in a comment about in-lined code.

mikeytown2’s picture

Status: Needs review » Reviewed & tested by the community

Moving back to RTBC as I've only added in comments to the code in question.

mgifford’s picture

Issue tags: -Performance
mgifford’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (won't fix)

It's been RTBC for 2 years, but don't see this getting into Core for D6.