[wp-trac] [WordPress Trac] #11212: Add filter to wp_parse_args()

WordPress Trac wp-trac at lists.automattic.com
Sun Nov 22 01:28:47 UTC 2009


#11212: Add filter to wp_parse_args()
--------------------------+-------------------------------------------------
 Reporter:  Viper007Bond  |       Owner:                
     Type:  enhancement   |      Status:  new           
 Priority:  lowest        |   Milestone:  Future Release
Component:  General       |     Version:  2.9           
 Severity:  normal        |    Keywords:  has-patch     
--------------------------+-------------------------------------------------

Comment(by filosofo):

 Replying to [comment:9 Viper007Bond]:
 > '''If that parameter is set''', then `wp_parse_args()` fires a filter
 called `wp_parse_args_the_function_name`.

 My bad.  I thought you were talking about passing the function name as an
 argument.

 > As for performance, there's no difference between adding a filter inside
 each function or just one dynamic filter inside of `wp_parse_args()` --
 it's the same number of `apply_filters()`.

 Well, not exactly. With the "`wp_parse_args___FUNCTION__`" filter, you're
 calling apply_filters to every single use of wp_parse_args, in plugin and
 core, whether it needs one or not.

 > About a 100 calls to it '''with a callback''' only adds a couple
 milliseconds.

 I'm willing to believe your general point---that the performance impact is
 minimal---but it needs more testing.  Those numbers don't mean much in
 isolation: what are we talking about, your multi-core dev environment? :)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11212#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list