[wp-trac] [WordPress Trac] #15458: Lazy-load usermeta into the user object

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 22 08:29:23 UTC 2011


#15458: Lazy-load usermeta into the user object
-------------------------+-----------------------------
 Reporter:  nacin        |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Performance  |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  3.2-early    |
-------------------------+-----------------------------

Comment (by nacin):

 Replying to [comment:6 Denis-de-Bernardy]:
 > For the same reason as posts, making dozens of queries per user is more
 expensive than making a single one for all users.
 >
 > Are we even loading these things for all queried users in one go? If
 not, agreeing wholly; if so, disagreeing based on the above.

 This is commonly seen when querying the current user, not necessarily all
 queried users. Multiple-user usermeta queries is not common.

 I think a solution is to allow WP_User to be instantiated with only a
 whitelisted (and filterable) subset of usermeta being queried. This would
 be leveraged for querying the current user's user meta, which obviously is
 loaded into memory.

 When a non-whitelisted usermeta key is requested, we should then load ALL
 usermeta, not just that key, to allow other keys to hit the cache. The
 whitelist should be large enough to cover core usage, and beyond that,
 it'll at least keep the memory footprint lower than it is now.

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


More information about the wp-trac mailing list