[wp-trac] [WordPress Trac] #16137: wp_list_filter() is inexact when dealing with nested arrays

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 19 04:55:55 UTC 2011


#16137: wp_list_filter() is inexact when dealing with nested arrays
----------------------------------------+------------------
 Reporter:  scribu                      |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  3.3
Component:  General                     |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |
----------------------------------------+------------------

Comment (by scribu):

 It seems using a foreach is actually faster than array_intersect_assoc().

 Using [attachment:wplf-test.php] I get:

 {{{
 wp_list_filter_old: 1.6865890026093
 wp_list_filter_new: 1.3801169395447
 wp_list_filter_new2: 1.871533870697
 }}}

 wp_list_filter_new is the one in [attachment:16137.patch].

 wp_list_filter_new2 uses an if + get_object_vars(). Although I made this
 suggestion, I think it's better to just use casting to arrays.

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


More information about the wp-trac mailing list