#56637 closed defect (bug) (fixed)
Bug/performance: Repetitive calls to file_get_contents
Reported by: | aristath | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | 6.1 |
Component: | General | Keywords: | has-patch add-to-field-guide |
Focuses: | performance | Cc: |
Description
While running tests with Xdebug & web grind, I identified repetitive calls to file_get_contents()
from the get_default_block_editor_settings()
function.
That function repeatedly gets the contents of the /css/dist/block-editor/default-editor-styles.css
without any implementation to avoid those.
This is an easy bugfix, and involves using a static variable in the function. Details and screenshots in the PR.
Change History (10)
This ticket was mentioned in PR #3318 on WordPress/wordpress-develop by aristath.
2 years ago
#1
- Keywords has-patch added
#2
@
2 years ago
Edit: There was an error in the 2nd screenshot above.
Total self-cost goes down from 160ms to 93ms, not 1.88 (I forgot to switch from % to ms values in the after image)
Screenshot & text updated in the PR, but these changes don't get reflected in the comment above from the Github-sync bot.
mukeshpanchal27 commented on PR #3318:
2 years ago
#3
@aristath Left one comment. Does that make sense to you?
#5
in reply to:
↑ 4
@
2 years ago
Replying to mukesh27:
Is it specific to Editor or General component ticket?
General. The get_default_block_editor_settings()
function runs on the frontend as well (it's used in the JSON resolver), so the impact is global and not just the editor
#7
@
2 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 54291:
SergeyBiryukov commented on PR #3318:
2 years ago
#8
Thanks for the PR! Merged in r54291.
Fixes repeat calls to
file_get_contents
Testing on WP 6.1 (trunk), on the front-page of a site using Xdebug & webgrind: (values in milliseconds)
Before the patch:
After the patch:
Invocation count goes down from 181 to 93. Total self-cost goes down from 160ms to ~2ms
Trac ticket: https://core.trac.wordpress.org/ticket/56637