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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, skinr-6.x-1.x-performance.patch, failed testing.

kbahey’s picture

The patch for the most recent dev branch passes.

So effectively this is "needs review".

moonray’s picture

Reviewing D7 patch:
Have you run any performance tests to prove the efficacy of this patch?
Both skinr_get_skin_info() and theme_get_registry () are cached in their own functions. The only one that has no caching (which seems fairly minimal) is skinr_current_theme().

moonray’s picture

Status: Needs work » Postponed (maintainer needs more info)
mikeytown2’s picture

moonray’s picture

I 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).

moonray’s picture

Status: Postponed (maintainer needs more info) » Patch (to be ported)
FileSize
3.02 KB

Attached is my updated patch. It's slightly cleaner and has inline comments.

moonray’s picture

And here's the D6-2.x patch.

moonray’s picture

Status: Patch (to be ported) » Fixed
FileSize
3.44 KB

And lastly, the 6.x-1.x patch.

All have been committed.

Status: Fixed » Closed (fixed)

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

CzarnyZajaczek’s picture

I'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

CzarnyZajaczek’s picture

Issue summary: View changes

Adding link to article describing the issue.

ezeedub’s picture

Version: 7.x-2.x-dev » 6.x-1.7
Issue summary: View changes
Status: Closed (fixed) » Needs work
+++ b/skinr.module
@@ -334,8 +340,8 @@ function skinr_preprocess(&$vars, $hook) {
+          if (!empty($data['info'][$current_theme]['skins'][$skin]['stylesheets'])) {
+            foreach ($data['info'][$current_theme]['skins'][$skin]['stylesheets'] as $media => $stylesheets) {

Oops, $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)

  • moonray committed c93455b on 8.x-2.x
    Issue #1916534 by kbahey, moonray: Added performance improvements for...
moonray’s picture

Status: Needs work » Closed (fixed)