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.
There's only a couple of variables in drupal_lookup_path() which really need to use drupal_static(). This saves about 3% of page execution time and 6,000 function calls on a node with 300 comments.
Comment | File | Size | Author |
---|---|---|---|
#11 | path_lookup.patch | 7.69 KB | catch |
#10 | path_lookup_2.patch | 7.4 KB | catch |
#8 | head.png | 386.25 KB | catch |
#8 | patch.png | 415.79 KB | catch |
#7 | path_lookup.patch | 7.4 KB | catch |
Comments
Comment #1
catchComment #2
Anonymous (not verified) CreditAttribution: Anonymous commentednice. very simple patch, RTBC in my opinion.
Comment #3
catchFixed up code comments a bit after feedback from pwolanin in irc, no functional change.
Comment #4
Damien Tournoud CreditAttribution: Damien Tournoud commentedWhy not having a single $cache variable:
Comment #5
catchUntested version of Damien's suggestion, which I like a lot better.
Comment #7
catchFixed the test fail.
Comment #8
catchHalves time spent in self, takes about 1/3rd off total time too for drupal_function_exists() on the default front page.
Comment #9
sunMissing spaces after
IN
.Aside from that, this looks good to go.
This review is powered by Dreditor
Comment #10
catchFixed the whitespace.
Comment #11
catchFixed some more.
Comment #12
sunComment #13
webchickHm! Not only does this speed up the page execution time, the resulting code seems much easier to read, as well.
Committed to HEAD.
Seems like we also change the documentation at http://drupal.org/update/modules/6/7#static_variable_api to removes the recommendation for using the colon-suffix in favour of this array-based approach.
Comment #14
catchUpdated, thanks!