[wp-trac] [WordPress Trac] #53670: Lazy-load admin functions in the new widgets editor REST API instead of bootstrapping the entire admin on every request

WordPress Trac noreply at wordpress.org
Fri Jul 16 14:19:26 UTC 2021


#53670: Lazy-load admin functions in the new widgets editor REST API instead of
bootstrapping the entire admin on every request
--------------------------+----------------------
 Reporter:  zieladam      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:
 Severity:  normal        |  Resolution:  wontfix
 Keywords:  dev-feedback  |     Focuses:
--------------------------+----------------------
Changes (by zieladam):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 I measured 10 batches of 100 requests to `/wp/v2/widget-types` with and
 without https://github.com/WordPress/gutenberg/pull/33454 using apache
 benchmark with `-n 100` (100 sequential requests).

 With GB33454 I got results between 307ms and 317ms
 Without GB33454 I got results between 307ms and 315ms

 Some of the variance may be attributed to my local development setup,
 varying workload of the machine, things like that. Still, some of these
 will also occur on shared and even dedicated hosts.

 The difference in speed is minimal if there even is one: Maybe this could
 be explained by sheer randomness. I am not going to calculate any
 confidence intervals though. Also, this is going matter even less in a
 production setting with something like APC enabled.

 Memory-wise, I checked `memory_get_usage()` before and after the
 `require_once ABSPATH . 'wp-admin/includes/admin.php';` statement and got
 the following reads:

 Before: `int(4282056)`
 After: `int(4388768)`

 100KB of difference in ram usage per request on an admin-specific endpoint
 – I think that's negligible.

 This tells me two things:

 1. Adding any additional complexity just to prevent including some
 functions isn't worth it, even it's 700 functions and a bunch of classes.
 2. https://github.com/WordPress/gutenberg/pull/33454 could likely be
 restored without any  negative effects

 Either way, we're good to close this ticket.

 cc @hellofromtonya @adraganescu @desrosj

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


More information about the wp-trac mailing list