[wp-trac] [WordPress Trac] #3875: Proposal for a new plugin
architecture
WordPress Trac
wp-trac at lists.automattic.com
Mon Feb 26 11:19:23 GMT 2007
#3875: Proposal for a new plugin architecture
--------------------------+-------------------------------------------------
Reporter: FraT | Owner: anonymous
Type: enhancement | Status: new
Priority: low | Milestone: 2.2
Component: Optimization | Version: 2.1.1
Severity: minor | Keywords: plugin plugins plugin.php $wp_filter wp-includes
--------------------------+-------------------------------------------------
I'm proposing a new structure of $wp_filter array.
This one can prevents the loops to add and to remove filters.
With this changes the follow code is exec with not relevant differences:
{{{
for($i = 0, $j = 100000; $i<$j; $i++)
add_filter("tag$i", "funtion");
}}}
But this is faster:
{{{
for($i = 0, $j = 100000; $i < $j; $i++)
for($i2 = 0, $j2 = 3; $i2 < $j2; $i2++)
add_filter("tag$i", "funtion$i2");
}}}
The core of my proposal is to change the add_filter function with this
one:
{{{
function add_filter($tag, $function_to_add, $priority = 10, $accepted_args
= 1) {
global $wp_filter;
$wp_filter[$tag][$priority][serialize($function_to_add)] =
array('function' => $function_to_add, 'accepted_args' => $accepted_args);
return true;
}
}}}
--
Ticket URL: <http://trac.wordpress.org/ticket/3875>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list