Because it doesn't make any sense, and because it leads to 70 pointless function calls in vanilla head, a lot more on real sites.

Comments

catch’s picture

Priority: Minor » Normal
StatusFileSize
new1.12 KB

Same thing with drupal_load() - attached patch does both. This is in the critical path for any full Drupal bootstrap, so back to normal status

c960657’s picture

Status: Needs review » Needs work
+  // Whether a file is loaded or not can not change during a request, so do
+  // not use drupal_static() here.

This doesn't sound right. Whether a file is loaded can change from false to true, but not the other way around.

The code looks good, though. It is only wording in the comment, I am objecting to.

catch’s picture

Title: drupal_get_filename() should not use drupal_static() » drupal_get_filename() and drupal_load() should not use drupal_static()
Status: Needs work » Needs review
StatusFileSize
new1.13 KB
new1.13 KB

Makes sense, re-rolled with the comment change.

Also attached before/after webgrind screenshots which show drupal_load() and drupal_get_filename() in the top ten most expensive functions (on a vanilla install with no content).

catch’s picture

StatusFileSize
new531 KB
new512.3 KB
pwolanin’s picture

Right - doesn't make sense for this to be a drupal_static and this might be one of the reasons why simpltest explodes if you do a call to drupal_static_reset() (i.e. reset everything) in setUp

Status: Needs review » Needs work

The last submitted patch failed testing.

catch’s picture

Status: Needs work » Needs review

HEAD broken.

Anonymous’s picture

catch’s picture

Status: Needs review » Reviewed & tested by the community

Test bot is green, while I had a hand in this it's an obvious patch so marking RTBC.

pwolanin’s picture

Agree this is RTBC - simply a matter of logic.

casey’s picture

Same for module_implements(); functions (hook implementations) don't disappear during a request.

casey’s picture

Never mind, it's cache is reused in module_implements_write_cache().

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.