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.

CommentFileSizeAuthor
#1 Desk 1_046.png108.07 KBcatch
#1 Desk 1_047.png96.55 KBcatch
file-uri-scheme.patch617 bytesmfb
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
96.55 KB
108.07 KB

The 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.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -Performance

Automatically closed -- issue fixed for 2 weeks with no activity.