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.
The function skinr_preprocess(), when called many times, consumes a considerable share of the overall page generation time.
The attached patches solve this problem by statically caching the parts that consume resources.
Full description can be found at Solving High CPU usage and reducing page generation times due to Skinr module.
Comment | File | Size | Author |
---|---|---|---|
#9 | skinr-performance-1916534-8-6.x-1.x-do-not-test.patch | 3.44 KB | moonray |
#8 | skinr-performance-1916534-8-6.x-2.x-do-not-test.patch | 2.86 KB | moonray |
#7 | skinr-performance-1916534-7.patch | 3.02 KB | moonray |
skinr-6.x-1.x-performance.patch | 1.33 KB | kbahey | |
skinr-6.x-2.x-performance.patch | 1.38 KB | kbahey | |
Comments
Comment #2
kbahey CreditAttribution: kbahey commentedThe patch for the most recent dev branch passes.
So effectively this is "needs review".
Comment #3
moonray CreditAttribution: moonray commentedReviewing D7 patch:
Have you run any performance tests to prove the efficacy of this patch?
Both
skinr_get_skin_info()
andtheme_get_registry ()
are cached in their own functions. The only one that has no caching (which seems fairly minimal) isskinr_current_theme()
.Comment #4
moonray CreditAttribution: moonray commentedComment #5
mikeytown2 CreditAttribution: mikeytown2 commentedThere is a whole article on this patch
http://2bits.com/cpu/solving-high-cpu-usage-and-reducing-page-generation...
Comment #6
moonray CreditAttribution: moonray commentedI did the same tests as the article described in the drupal 7 version, and with or without the patch I get pretty much identical results.
Perhaps the problems are only there on the 6.x versions?
EDIT: Running tests on D6-2.x I'm not getting very different results either between the two versions.
EDIT 2: Now, granted, I'm working with a close to vanilla site with a few skins applied. Considering this is a small patch that might improve performance, but has no negatives to it, I'll add it (with some minor tweaks).
Comment #7
moonray CreditAttribution: moonray commentedAttached is my updated patch. It's slightly cleaner and has inline comments.
Comment #8
moonray CreditAttribution: moonray commentedAnd here's the D6-2.x patch.
Comment #9
moonray CreditAttribution: moonray commentedAnd lastly, the 6.x-1.x patch.
All have been committed.
Comment #11
CzarnyZajaczek CreditAttribution: CzarnyZajaczek commentedI've tested it, surprisingly it makes difference - 70 calls to skinr_preprocess, and difference about 90 to 130 ms on one of my Drupal 6 installations. Thanks for that patch
Comment #11.0
CzarnyZajaczek CreditAttribution: CzarnyZajaczek commentedAdding link to article describing the issue.
Comment #12
ezeedub CreditAttribution: ezeedub commentedOops, $current_theme is removed above (should be string literal 'current_theme'). (probably should have opened a new issue since this is already merged... apologies if that's the case)
Comment #14
moonray CreditAttribution: moonray at Chapter Three commentedSee #2630622: Undefined variable: current_theme for followup problem.