huge site speedup by commenting out two stylesheets; what did I break?

Home PageForumsArchives – How-To and Troubleshootinghuge site speedup by commenting out two stylesheets; what did I break?

This topic is: not resolved

This topic has 4 voices, contains 9 replies, and was last updated by  jorisw 475 days ago.

Viewing 10 posts - 1 through 10 (of 10 total)
Author Posts
Author Posts
December 14, 2010 at 5:19 am #156573

MikeBegley
New Member

Using yslow, I noted that loading product_rater.css and wpsc_user_dynamic_css took the lions share of the load time; usually about 10-15 seconds. I don’t use product rating on my site, and I saw some posts commenting that wpsc_user_dynamic_css was save to remove, so I commented them out of enqueued files in theme.functions.php.

Now my site is extremely responsive, and I haven’t seen anything not functioning. So I have a couple of questions:

1) What could I have possibly broken by commenting out these two stylesheets?
2) Why is bringing down these two stylesheets so slow?

thanks,
-mike

December 14, 2010 at 5:54 am #156574

Roy Ho
Resident Expert
Trusted

That is strange finding because dynamic.css is extremely small file…like less than 100 lines of code if single spaced and rating css is maybe 200 lines at most……

December 14, 2010 at 6:05 am #156575

MikeBegley
New Member

Oh, duh, I know why.

That’s a file that seems to he hardcoded in the plugin to be delivered using http. That causes the Dreaded Mixed Content warning in IE, so I added it to the list of files that the Mavis HTTPS redirector always sends down as https (along with wpsc_user_dynamic_js. however, that file doesn’t seem to impact the overall speed of page delivery).

Not an ideal solution, but it worked.

I guess the proper solution would be to make those two files come down using the correct delivery protocol (https when on a secure page, http otherwise). I was never able to find a working solution to this in the forums, which is why I tried the redirector solution.

December 14, 2010 at 7:03 am #156576

MikeBegley
New Member

So what is the proper way to deliver these files, making sure they’re using SSL or not, properly?

December 14, 2010 at 9:09 am #156577

MikeBegley
New Member

I’ve done a smidge more investigation.

What’s going on is that with each request, index.php is getting run with parameters to generate a custom css for that category, which is then used to render the category. It’s kind of a clever way of doing it, but something of a performance killer.

Since I’m not using custom stylesheets per category, I decided to save a static one rather than render a new one with each access.

using wget, I connected to http://www.seattlelumin.com/index.php?wpsc_user_dynamic_css=true&category=1 and saved the response into css/category.css. I then edited theme.functions.php to replace this line:

wp_enqueue_style( ‘wp-e-commerce-dynamic’,$siteurl.”/index.php?wpsc_user_dynamic_css=true&category=$category_id” , false, $version_identifier, ‘all’ );

with this line:

wp_enqueue_style( ‘wp-e-commerce-dynamic’,WPSC_URL.’/css/category.css’ , false, $version_identifier, ‘all’ );

Now I know I’m getting all the stylesheets that I need, and much higher performance.

I suggest that the devs consider a better performing method of sending down custom stylesheets for each category.

December 14, 2010 at 9:32 am #156578

minty
New Member

Hey Mike,

Exactly where is the theme.functions.php file you mention? I checked the functions.php in each of the themes directories (default/ishop/marketplace) and couldn’t find anything.

Like you, I don’t need custom css per category, and I also find the plugin can be glacial. Any speed bump would be great (assuming my gold support request for broken Paystation ever gets answered and it actually functions as advertised…)

December 14, 2010 at 10:50 am #156579

MikeBegley
New Member

well, what do ya know…I’m not the first one to run into this problem; someone already even made a plugin to solve it:

http://wordpress.org/extend/plugins/disable-wp-e-commerce-dynamic-style-sheet/installation/

Essentially, it deregisters the dynamic stylesheet. It’s kind of a bandaid solution, but it seems to work.

December 14, 2010 at 11:05 am #156580

minty
New Member

Nice. Thanks for the heads up!

December 14, 2010 at 11:07 am #156581

MikeBegley
New Member

My code-editing solution, by the way, was this:

1) create the static css:
cd <PLUGIN ROOT>
mkdir css
wget “http://<DOMAIN NAME>/index.php?wpsc_user_dynamic_css=true&category=1″ -O css/category.css

2) change line 185 in version 3.7.8 wpsc_includes/theme.functions.php from this:

wp_enqueue_style( ‘wp-e-commerce-dynamic’,$siteurl.”/index.php?wpsc_user_dynamic_css=true&category=$category_id” , false, $version_identifier, ‘all’ );

to this:

wp_enqueue_style( ‘wp-e-commerce-dynamic’,WPSC_URL.”/css/category.css” , false, $version_identifier, ‘all’ );

And save.

January 28, 2011 at 9:47 pm #156582

jorisw

Roy,

I hope you or Dan are aware that those two CSS files are generated on the fly by WPSC. Why exactly that is I’m not sure, but the logic behind those requests is apparantly so bloated that it slows down the entire website for many of us, by the seconds, for each pageload. Even with a cache plugin installed.

Please investigate this. It’s precisely these types of issues that, while WP E-Commerce is a great and generous project, make WP E-Commerce a slow and high maintenance solution.

To everyone else: Just save the output of those files from your browser to a file, upload it to a cache directory, and use rewrite rules in .htaccess to read those files instead of the request going through WP E-Commerce.

Viewing 10 posts - 1 through 10 (of 10 total)

The forum ‘Archives – How-To and Troubleshooting’ is closed to new topics and replies.