WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5335 closed enhancement (invalid)

Performance tweak for apply_filters loop

Reported by: Quandary Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.3.1
Component: Optimization Keywords: dev-feedback
Focuses: Cc:

Description

This patch uses foreach to reduce the time it takes to execute apply_filters (on my box) from an average of 120,694 ticks/standard deviation 33,038 ticks, to an average of 99,149 ticks/standard deviation 20,636 ticks. The sample size was 20 runs each, before and after.

Attachments (2)

use_foreach_in_apply_filters.diff (669 bytes) - added by Quandary 10 years ago.
Optimize apply_filters
use_foreach_with_wp_filter.diff (2.2 KB) - added by Quandary 10 years ago.
Use foreach everywhere $wp_filter is iterated over

Download all attachments as: .zip

Change History (12)

@Quandary
10 years ago

Optimize apply_filters

@Quandary
10 years ago

Use foreach everywhere $wp_filter is iterated over

#1 @Quandary
10 years ago

Stats on the second patch:

originalpatched
total runtime (mean)1,972,8541,943,093
total runtime (std dev)116,697110,741
add_filter (mean)14,42414,592
add_filter (std dev)5,4583,224
apply_filters (mean)120,694103,971
apply_filters (std dev)33,03825,880

Sample size is still 20.

#2 @lloydbudd
10 years ago

  • Milestone changed from 2.2.3 to 2.4

#3 @lloydbudd
10 years ago

  • Type changed from defect to enhancement

#4 @Quandary
10 years ago

For the record, this patch is written and tested against 2.3.1, not 2.4/trunk.

#5 @lloydbudd
10 years ago

  • Version changed from 2.3 to 2.3.1

#6 @santosj
10 years ago

  • Keywords dev-feedback added

Is this still applicable for 2.3.x branch? Since none of these enhancements will apply to trunk, this isn't an issue for trunk and if it isn't going to go into 2.3.x, then it should be closed.

Right?

#7 @lloydbudd
10 years ago

  • Keywords has-patch removed
  • Milestone changed from 2.4 to 2.5

Well, it would be unlikely to include this type of change in a maintenance release. Although the patches don't apply to trunk, do the concepts or are the issues already resolved on trunk using other code?

#8 @darkdragon
10 years ago

  • Resolution set to invalid
  • Status changed from new to closed

No. This was the ticket for 2.3.x and I made a ticket for trunk that was recently closed. If this isn't going to be applied to 2.3.x, then it just should be closed.

#9 @lloydbudd
10 years ago

  • Milestone 2.5 deleted

darkdragon, it would have been awesome if you included that other ticket # ;-)

Note: See TracTickets for help on using tickets.