Ticket #6796 (closed enhancement: fixed)

Opened 4 months ago

Last modified 4 months ago

Convert Walker classes to pass $output as reference

Reported by: mdawaffe Assigned to: anonymous
Priority: normal Milestone: 2.5.1
Component: General Version: 2.5
Severity: normal Keywords:
Cc:

Description

The Walker classes pass the $output variable back and forth between their methods many many times, each time making the variable bigger and bigger. For walkable data with many items, this means the classes are copying very large variables many many times.

Converting the Walkers to pass $output by reference gives us a modest speed increase.

On a site with ~3200 categories (yes, that's a lot), the attached patch gave me ~35% decrease in the time it took Walker::walk() to output the $output created by Walker_Category_Checklist.

Note that any speed boost will only be significant in very large lists. Only then is $output copied many times and only then is $output very large.

Attached passes $output by reference in Walker and all core inheriting classes. Depending on how they are written, most Walker classes from plugins will work fine with these core modifications (but will not get the speed boost).

2.5.1?

Attachments

6796.diff (8.9 kB) - added by mdawaffe on 04/21/08 19:25:02.

Change History

04/21/08 19:25:02 changed by mdawaffe

  • attachment 6796.diff added.

04/21/08 19:30:57 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [7761]) Convert Walker classes to pass as reference. Props mdawaffe. fixes #6796 for trunk

04/21/08 19:31:39 changed by ryan

  • milestone changed from 2.6 to 2.5.1.

Nominating for 2.5 pending further testing on trunk.

04/22/08 21:06:00 changed by ryan

(In [7770]) Convert Walker classes to pass as reference. Props mdawaffe. fixes #6796 for 2.5