[wp-trac] [WordPress Trac] #26640: Performance Increase in apply_filter() (~11%)

WordPress Trac noreply at wordpress.org
Fri Aug 15 23:36:57 UTC 2014


#26640: Performance Increase in apply_filter() (~11%)
-------------------------+-----------------------------
 Reporter:  dshafik      |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Plugins      |     Version:  1.5
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  performance
-------------------------+-----------------------------
Changes (by dshafik):

 * keywords:  has-patch needs-refresh => has-patch


Comment:

 I have uploaded a new patch, against the latest github master HEAD, this
 will now do the quickest thing possible based on the version. This will
 now work in all supported versions of PHP!

 1. When the callback is a simple string, or a Closure, it will **always**
 use the faster switch method.
 2. When the callback is **NOT** a string/Closure, on PHP >= 5.4 it will
 use the faster switch method, on < 5.4 it'll use the old
 `call_user_func_array()` as a fallback.

 Possible callbacks include:
   - Strings (global functions)
   - Closures
   - Array containing classname/method (static)
   - Array containing object/method
   - Object instances of classes with an `__invoke()` magic method

--
Ticket URL: <https://core.trac.wordpress.org/ticket/26640#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list