Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
file_uri_scheme() is called a *lot* at certain times, such as when all module files are scanned while loading the admin/config page. In this case these URIs, so to speak, don't even have a scheme. This patch almost doubles the performance of file_uri_scheme() when the URI doesn't have a scheme by just making one function call. There is also a small speed boost when the URI does have a scheme, thanks to the string functions being a bit faster than array functions.
Comment | File | Size | Author |
---|---|---|---|
#1 | Desk 1_046.png | 108.07 KB | catch |
#1 | Desk 1_047.png | 96.55 KB | catch |
file-uri-scheme.patch | 617 bytes | mfb | |
Comments
Comment #1
catchThe full system scans on admin/config are due to #1014130: install_profile_info() does a file system scan on every request to admin/config (and etc.). However there's obviously plenty of other places that we do them and this patch looks good.
I profiled admin/config (without git pull so that bug was still there) with the patch applied, and saw a decent improvement in xhprof - attached screenshots. The raw numbers aren't very useful from only two runs, but you can see 50k saved in memory, and what looks like about 40% CPU within the function.
Patch is at least as readable as what we have there already, and all tests pass, so RTBC.
Comment #2
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.