[buddypress-trac] [BuddyPress Trac] #6864: `bp_sort_by_key()` is slow

buddypress-trac noreply at wordpress.org
Wed Feb 3 03:57:27 UTC 2016

#6864: `bp_sort_by_key()` is slow
 Reporter:  boonebgorges           |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  2.5
Component:  API                    |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  2nd-opinion has-patch  |
Changes (by boonebgorges):

 * keywords:  2nd-opinion => 2nd-opinion has-patch


 Replying to [comment:1 DJPaul]:
 > I just tested your first approach because I didn't think it'd get past
 the parser, and it doesn't work :) https://3v4l.org/qutlJ

 Oh, you and your technicalities :-D

 Two attachments.

 a. [attachment:6864-global.diff] implements my suggestion 2 above.
 b. [attachment:6864-class.diff] implements suggestion 3.

 Neither is as fast as a closure, but both are much faster than
 `create_function()`. In my quick benchmarks, approach
 [attachment:6864-class.diff] is about 10x faster than what we've currently
 got, while [attachment:6864-global.diff] is 2-3x faster (the
 `buddypress()` access is expensive; it may be faster to have standalone
 globals, but *shudder*)

 I'm recommending we go with [attachment:6864-class.diff] unless someone
 has strong feelings against it.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6864#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list