[wp-trac] [WordPress Trac] #58384: locate_template calls file_exists a lot
WordPress Trac
noreply at wordpress.org
Tue May 23 14:58:49 UTC 2023
#58384: locate_template calls file_exists a lot
--------------------------+-----------------------------
Reporter: spacedmonkey | Owner: (none)
Type: enhancement | Status: new
Priority: high | Milestone: Future Release
Component: Themes | Version: 4.7
Severity: normal | Resolution:
Keywords: | Focuses: performance
--------------------------+-----------------------------
Comment (by costdev):
Thanks for opening this ticket @spacedmonkey! Worth looking into for sure.
**file_exists** results are cached by PHP:
Note: The results of this function are cached. See `clearstatcache()` for
more details.
[https://www.php.net/manual/en/function.file-exists.php#refsect1-function
.file-exists-notes Reference]
So while this reduces the impact of filesystem calls, having a cache for
the results of the `foreach()` loop may be useful here.
Have you run any tests to see how much of a performance improvement a
cache of these results brings?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58384#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list