[wp-trac] [WordPress Trac] #22189: Saving navigation menus is slow

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 15 04:12:42 UTC 2012


#22189: Saving navigation menus is slow
--------------------------+------------------
 Reporter:  nacin         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.5
Component:  Menus         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------

Comment (by nacin):

 Some of these things, you may notice, are legitimate bugs or less-than-
 ideal API behavior. But a decent amount of this is also only a problem
 when you are saving a ton of posts at once. The only similar situation for
 core is bulk_edit_posts(), which A) could probably be made faster (I
 haven't checked) and B) isn't unexpected by the user to be super fast. Try
 running an operation on a few hundred or thousand Gmail messages. It
 understandably takes time.

 We can probably make some adjustments to make some of this work better at
 scale. The biggest ones are probably to improve the order in which
 metadata sets, term sets, and term counting is performed from
 wp_insert_post(). Some of this would mean new API such as a 'meta' array —
 #20451 — so things can be done all in one go, either before or after the
 cache clear, depending. I'm also looking very curiously at the actual need
 to flush an object's metadata when we clear its cache too (aside from
 object deletions).

 With regards to term counting, what I was seeing is that term counting
 (triggered by post status changes) was getting deferred, but in order to
 defer them, term IDs were still fetched for each object (to be entered
 into the defer queue), which triggered a new term cache fetch for each
 object. It would be cooler if objects themselves were deferred, that way
 an enterprising individual could defer term counting, update a ton of
 posts, fetch the term cache for all of those posts at once, then run the
 count queue.

 Of course, neither term counts (especially on post status changes) are
 even needed for menu items, which is another story.

 Overall, while there is continued room for improvement, this is a quick
 bite at the apple to speed up menus now.

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


More information about the wp-trac mailing list