Skip to content

Abysmal response time when fetching pages to be listed in page attributes. 2nd try #13618

Closed
@bobbingwide

Description

Describe the bug
The time to populate the Parent Page: pull down in the Page Attributes settings box is still abysmal.

I'm raising this since #5376 was closed without being fixed.
I re-discovered the problem while attempting to resolve a similar problem to that reported in #9441.

To Reproduce

  1. Edit a hierarchical post type, such as Pages, in a site which has a lot of pages and where the pages contain multiple shortcodes which could take a long time to expand.
  2. Measure the time taken to populate the Parent Page: pull down.
  3. Tabulate the results and compare with the time to load the classic-editor.

Expected behavior
Page parent to be populated as quickly or faster than in the Classic Editor.

Observed behaviour
Multiple REST requests of the form
https://s.b/oikcom/wp-json/wp/v2/pages?per_page=100&exclude=7413&parent_exclude=7413&orderby=menu_order&order=asc&context=edit&_locale=user
with the second and subsequent requests including &page=n

  • Each REST request took an absolute age to respond.
  • Every single page was being expanded, and all the shortcodes were being expanded
  • For both the_content and get_the_excerpt.
  • When the elapsed execution time exceeded 120 seconds my local server terminated the request.
  • Changing my code to not expand shortcodes reduced the elapsed time so that I did finally get to see the Parent Page: dropdown.

I notice that that requests do not include the _fields=id,title,parent parameter that was suggested would help with the performance.

When I add this parameter manually the performance is significantly better.

https://s.b/oikcom/wp-json/wp/v2/pages?per_page=100&exclude=7413&parent_exclude=7413&orderby=menu_order&order=asc&_locale=user&_fields=id,parent,title

Server execution reduced from 4.3 secs to 0.9
Note: Tested in browser with &context=edit removed.

Screenshots
image

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome

Additional context

  • WordPress 5.0.3 with / without Gutenberg 4.9

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions