[wp-trac] [WordPress Trac] #47871: Cache item schema in REST controllers

WordPress Trac noreply at wordpress.org
Tue Aug 13 20:11:13 UTC 2019


#47871: Cache item schema in REST controllers
-------------------------+---------------------
 Reporter:  joehoyle     |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  5.3
Component:  REST API     |     Version:  4.7
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+---------------------

Comment (by kadamwhite):

 I did some basic naive performance profiling by wrapping the post
 controller's get_item_schema method with a microtime diff and counting how
 often it was called. On a `wp/v2/posts` collection with two posts,
 `get_item_schema` is called on the posts controller 56 times total,
 accounting for roughly 30ms of time.

 On a collection of 100 posts, however, a `wp/v2/posts?per_page=100`
 request generated 644 individual get_item_schema requests. Using the naive
 microtime logging, these calls accounted for around 290-300ms within one
 request's lifecycle over a series of tests, with a few outlier runs
 yielding up to 700ms of total time.

 I would be quite keen to get this in and see those numbers drop :)

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


More information about the wp-trac mailing list