Speed Up Your CS-Cart eCommerce Website - Step 1

Hello Flow,



I need to reduce my CSS file which is very fat (96 Kb after bundling all the CSS files into one and compaction).



I think I can bring down the size to about 20 Kb. In this way, the pages will be simpler, smaller and lighter.



More, I don’t talk to you how to reduce pictures size, how to group them, how to manage CSS to reduce size, how to do… Thousands of small things to get a high level in Yslow and Page Speed.



Nevertheless, I don’t want talk of these steps, because you could say of me: You’re absolutely crazy!



But no, I’m not the Speedmeister you think I am.



The only Meister is Casinomeister. The only casino I played was the late Global Player Casino, closed now for years. This casino was the only one where you could make a Card Counting, because their proprietary software of blackjack renewed the shoe every 15 to 25 hands.



Yes gambling is illegal in China. Yes gambling is a problem for Chinese people. Try to curb her sins is not easy every time…



So I am a member of this forum which is trying to share what seems useful to everyone… Free of charge.



Not like in a casino where you can just lose your shirt in a minute…





Lee Li Pop

I just upgraded one of our sites from 2.1.2 to 2.1.3 and we went from “C’s” to

Page Speed Grade:

(79%)



YSlow Grade:

(86%)



Has anyone else seen any speed increase from the upgrade? I know CS said that it would be less database contacts.

It’s a bit faster but we went up only 1 or 2 points (to a good mid 80’s), nothing like this!

Hi Lee Li



I managed to get the gzip compression, however, the new results on GTMetrix are the same as before, any idea what went wrong ? Also When you say if we clean up and correct code, we can easily get 90 %, could you let me know how to do that please, thank you very much in advance. You’v been great. ,






[quote name=‘Lee Li Pop’]Hello E.Qi.Librium,



Your GTMetrix results are for your website in your signature:



YSlow Grade: (79%) C



Google Page Speed Grade: (77%) C



Better than the official CS-Cart demo results:



[url]Instant Demo - CS-Cart Multi-Vendor Demo Try Free for 15 days



YSlow Grade: (57%) E



Page Speed Grade: (70%) C



If you follow me trough all steps, you can easily get +85% B.



If you clean up and correct your code, you can easily get +90% A.



Go from E-C to B-B and (why not) A-A and your website will be from x2 to x4 times faster.



Easy way! :cool:



Remember:



A faster website, brings more customers and you get more money!



Everything is FREE, everything is made by yourself!



A last word, everything is as easy as this first step…



So, stay tuned on the Lee Li Pop’s optimization station!





Lee Li Pop[/QUOTE]

Hello Lee Li


[quote name=‘Lee Li Pop’]Hello All,



[SIZE=“3”]First of all, let’s go to check your website’s results on GTMetrix:[/SIZE]



[url]http://gtmetrix.com/[/url]



On WebPageTest:



[url]http://www.webpagetest.org/[/url]



And on Zoompf:



[url]http://zoompf.com/[/url]



*****



Nowadays, Google takes into account the speed of your website to determine your ranking in SERP.



[url]http://www.mattcutts.com/blog/site-speed/[/url]



[url]http://www.mattcutts.com/blog/minty-fresh-indexing/[/url]



[SIZE=“3”]The fastest and easy way to speed up your website, is to turn on the gzip compression.[/SIZE]



What is gzip compression?



The server compresses your pages by zipping them before sending to your visitors. Thus, the weight of your pages is lighter and therefore faster to load. Your site becomes faster, becoming compatible with the new Google rules.



How do I know if I can get gzip compression?



Follow this path:



Backoffice > Administration > Database > (click on link) “PHP Information”



On the new page that appears, search for “mod_deflate”



If “mod_deflate” is in “Loaded Modules”, then you officially have the ability to turn on gzip compression.



If “mod_deflate” is NOT there, don’t worry, read more…



How to officially have the gzip compression?



You have “mod_deflate” in “Loaded Modules”.



Edit your “.htaccess” file on your root and add this code:




SetOutputFilter DEFLATE





Please, note this:



If you have Smartoptimizer, add this code:




SetOutputFilter DEFLATE





Nota Bene:



Smartopitimizer is faster on JS and CSS than “mod_deflate” because it manages JS and CSS in static way. So, don’t put these files on “mod_deflate” if you have Smartoptimizer!



How to unofficially have the gzip compression?



You have NOT “mod_deflate” in “Loaded Modules”.



Edit your “index.php” file on your root and add to the first line, right after the CS-Cart copyright comments:


# Gzip here, because my web hosting company does NOT turn on gzip "mod_deflate".
ob_start("ob_gzhandler");




or:


# Gzip here, because my web hosting company does NOT turn on gzip "mod_deflate".
if(!ob_start("ob_gzhandler")) ob_start();




Test your page for gzip compression:



[url]http://www.whatsmyip.org/http_compression/[/url]



If you get a [COLOR=“Red”]red cross[/COLOR] , NOT a [COLOR=“Green”]green check[/COLOR] , thus, gzip compression is locked. Ask you support to know why.



Check your new results on GTMetrix:



[url]http://gtmetrix.com/[/url]



On WebPageTest:



[url]http://www.webpagetest.org/[/url]



And on Zoompf:



[url]http://zoompf.com/[/url]



Taste the difference :cool:







Lee Li Pop[/QUOTE]



I managed to get gzip compression, i also get green check on [url]http://www.whatsmyip.org/http_compression/[/url]

. However, the new results are the same. What might i have missed ? Thank you very much for your time.

I just ran the zoompf and one of the responses said…

[QUOTE]This external style sheet contains a single @import directive to include another style sheet. This causes the browser to make an additional HTTP requests to retrieve the additional sheet. Since this CSS file contains only a single @import you have should include the contents of imported style sheet in the base style sheet. This will reduce the number of HTTP requests required to load the web page improving page load times and decrease bandwidth consumption.[/QUOTE]

So does this mean if we have the site using “my changes” that allows the “hooks” to be used that this will negatively affect the site because it has to look at another style sheet?



I know the hooks are done to keep the upgrade easier and love it because of that. I am just curious on this.

Hello Clips,


[quote name=‘clips’]I just ran the zoompf and one of the responses said…



So does this mean if we have the site using “my changes” that allows the “hooks” to be used that this will negatively affect the site because it has to look at another style sheet?



I know the hooks are done to keep the upgrade easier and love it because of that. I am just curious on this.[/QUOTE]



1 - Avoid CSS @import:



[url]http://code.google.com/intl/fr-FR/speed/page-speed/docs/rtt.html#AvoidCssImport[/url]



2 - Combine external CSS (into one):



[url]http://code.google.com/intl/fr-FR/speed/page-speed/docs/rtt.html#CombineExternalCSS[/url]







Lee Li Pop

So is it the “hooks” or something that was already coded in CS?

If you check on pingdom, you’ll notice both files (main styles.css and my changes file) load simultaneously; styles.base.css follows after.



I tried the merged option, but the base.css will just add the load time to the styles.css file.



Maybe will be an improvement in speed if the styles are called when needed. For example, some part of the styles.css work for the checkout or product listing, and are not requiered on the front page.



Will be nice is the styles.css is splitted and called by active blocks or the styles.base.css is called rather than imported, so it loads simultaneously.

[quote name=‘clips’]So is it the “hooks” or something that was already coded in CS?[/QUOTE]



To answer your question. It’s not the hooks :slight_smile:

It’s a CSS file that calls another CSS file, nothing to worry about.

Thanks for the clarification flow!

Lee Li Pop,



I don’t have gzip, but I do have smart optimizer. Here is the code so far:




ExpiresActive On
ExpiresDefault "access plus 10 years"



RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*\.(js|css))$ smartoptimizer/?$1


RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*\.(js|css|html?|xml|txt))$ smartoptimizer/?$1



RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt))$ smartoptimizer/?$1



FileETag none




Should I add what you suggest in your first post? My site is really slow and I would like to speed it up. I have over 20,000 products so every little bit counts.



Thanks,



Adam

@ Adam

mod_deflate is enabled on your server as a static Apache module and it fully supports gzip. The instructions to determine that are incorrect in the first post.



I just looked through the server logs to see if I could find any reason why your store isn’t performing well and noticed many errors. These are mostly related to mailchimp but there are also a few others like below


[quote]PHP Warning: Division by zero in /home/account/public_html/addons/mailchimp/class.mailchimp.php on line 462



PHP Fatal error: Call to a member function returnResponse() on a non-object in /home/account/public_html/addons/twigmo/func.php on line 815



PHP Fatal error: Call to a member function read() on a non-object in /home/account/public_html/core/fn.fs.php on line 448



PHP Warning: mkdir() [function.mkdir]: File exists in /home/account/public_html/core/fn.fs.php on line 114



PHP Warning: gethostbyaddr() [function.gethostbyaddr]: Address is not a valid IPv4 or IPv6 address in /home/account/public_html/addons/access_restrictions/func.php on line 208[/quote]Not sure if any of those are impacting site performance but you should look into them

Please send me a list of any mailchimp errors you are seeing in your logs and I will fix and generate a new version immediately.



Edit: Ummm… Line 462 of the current version of mailchimp is a foreach() statement. There can be no divide by zero.

Please send me the version number by executing this URL:

?dispatch=mailchimp.version



You should be at version 2.1.12 which is most current.



Also looks like he’s running the beta stuff of the iPhone app here too…

$addon_cur_ver = ‘2.1.12’;



It’s this same error each time (4,328 times in 2 days)


Please email me his class.mailchimp.php file. Obviously something doesn’t match up here.

line 462 in my source base is:


foreach($subscriber_ar as $email => $sub_dat) {


In fact, I don’t see anywhere I’m doing any division in the class at all. It isn’t exactly a mathmatical addon…



There is a ‘mod’ operator (%) used o determine the “chunk” of data to send. However, it is a define of


define('MC_USER_BATCH_CHUNK_SIZE', 500);


so it should not be zero. It is then used in


if( ($idx++ % MC_USER_BATCH_CHUNK_SIZE) == 0 ) {




Note that this whole function is only used when doing an export of existing customers/users. So it certainly shouldn’t be repeating.



Also send me:

var/logs/mailchimp.log

I just sent you the file and errors Tony.

tbirnseth and S-Combs,



Thank you so much. That is first class service! I will recommend your products and services anytime.



I would do anything to speed up my site. I will email the error logs to CS-Cart and see what they can offer on those not related to the addons purchased from other companies.



Is there any code I need to add to take advantage of gzip?



Thanks,



Adam

There’s something very strange going on on your system.

Please contact me at tonybXX@ez-msXX.com (remove X’s). I will need to get onto your system to see what’s happening with mailchimp integration. Nothing makes sense from the info I’ve seen so far.

Thanks tbirnseth. I sent the information to your email address.