[wp-trac] [WordPress Trac] #56637: Bug/performance: Repetitive calls to file_get_contents

WordPress Trac noreply at wordpress.org
Fri Sep 23 13:58:33 UTC 2022


#56637: Bug/performance: Repetitive calls to file_get_contents
--------------------------+-----------------------------
 Reporter:  aristath      |       Owner:  SergeyBiryukov
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  6.1
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54291" 54291]:
 {{{
 #!CommitTicketReference repository="" revision="54291"
 Block Editor: Remove repetitive calls to `file_get_contents()` in block
 editor settings.

 The `get_default_block_editor_settings()` function used to repeatedly get
 the `default-editor-styles.css` file contents without any implementation
 to avoid this.

 This commit utilizes a static variable to remove repetitive calls made
 during the same request. In tests ran on the front page of a site using
 Xdebug & Webgrind, the total `file_get_contents()` invocation count goes
 down from 181 to 93, and total self cost (the time that the function is
 responsible for) goes down from 160 ms to 93 ms.

 Follow-up to [52042].

 Props aristath, mukesh27.
 Fixes #56637.
 }}}

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


More information about the wp-trac mailing list