Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How to Speed Up and Optimise CS-Cart Version 4? Rate Topic   * * * * * 1 votes

 

Posted 14 May 2014 - 03:20 PM #41

Thanks Don.

Attached Thumbnails

  • yslow.jpg


 

Posted 14 May 2014 - 05:56 PM #42

Where is the styles.less file and what exactly can we comment out if we dont use this feature..?? I am sure others would like to know also.

Elkhorn Graphics LLC
Cs-Cart 4.7.1  SP3


 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 814 posts

Posted 14 May 2014 - 06:48 PM #43

@CSD v4.1.4 using the Theme Editor, I think it compiles .CSS files from the .LESS files.
You can find the file styles.less in this location:
design/themes/responsive/css/styles.less
I commented out the line 1:
// @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,700&subset=latin,cyrillic-ext,cyrillic,latin-ext);
You could also search thru all your CS-Cart themes files for "googleapis" if the import URL is in some other CSS or LESS file in your version.

@Edward you need to add Expires values to your .htaccess file for sure.
If you don't have SmartOptimizer running on your v4 store, you can use the contents of this .htaccess file to add Expires values.
DirectoryIndex index.html index.php

<IfModule mod_rewrite.c>
    RewriteEngine on
    Options -MultiViews
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    AddEncoding gzip .gz
    RewriteCond %{REQUEST_FILENAME} \.(js|css)$
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule ^(.*)$ $1.gz [QSA,L]
    RewriteCond %{REQUEST_URI} ^api/(.*)$ [or]
    RewriteCond %{REQUEST_URI} .*/api/(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .*api/(.*)$ api.php?_d=$1&ajax_custom=1 [L,QSA]
    RewriteCond %{REQUEST_URI} \.(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff)$ [or]
    RewriteCond %{REQUEST_URI} store_closed.html$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*?)\/(.*)$ $2 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php [L,QSA]
</IfModule>
<IfModule mod_headers.c>
    <IfModule mod_expires.c>
	    Header append Vary: Accept-Encoding
	    Header unset ETag
	    FileETag None
	    ExpiresActive On
	    ExpiresDefault "access plus 1 month"
	    ExpiresByType text/html "access plus 1 day"
	    ExpiresByType image/x-icon "access plus 1 year"
	    <FilesMatch .*\.css.gz$>
		    Header unset ETag
		    FileETag None
		    ExpiresActive On
		    ExpiresDefault "access plus 1 year"
		    ForceType text/css
		    Header set Content-Encoding: gzip
		    Header set Cache-control: private
	    </FilesMatch>
	    <FilesMatch .*\.js.gz$>
		    Header unset ETag
		    FileETag None
		    ExpiresActive On
		    ExpiresDefault "access plus 1 year"
		    ForceType text/javascript
		    Header set Content-Encoding: gzip
		    Header set Cache-control: private
	    </FilesMatch>
    </IfModule>
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|css)$">
	    Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

This can be used for the ENTIRE contents of your .htaccess file. You can add in any additional stuff you are doing there, like 301 redirects and whatnot.

Smart Optimizer does minify the JS and CSS files though. I found it worthwhile to run it, as long as you don't compress your images with it and run gzip at the same time.

CS-Cart Ultimate ver 4.3.5


 
  • akistdm
  • Senior Member
  • Trial users
  • Join Date: 09-Oct 11
  • 233 posts

Posted 14 May 2014 - 07:43 PM #44

I found this code that work for the gzip compression.
<filesMatch "\.(js|css)$">
Header set Content-Encoding x-deflate
# Header set Content-Encoding compress
# Header set Content-Encoding x-gzip
</filesMatch>


 

Posted 14 May 2014 - 10:20 PM #45

Thanks Don.

However, it doesn't seem like anything changed. I still get a C.

This is the result I get with the .htaccess file exactly as you posted above.

I am not knowingly using SmartOptimizer. It would only be if someone added it without my knowledge.

Screen Shot 2014-05-14 at 6.19.43 PM.png

 
  • clips
  • Aged Resident Loon
  • Members
  • Join Date: 14-Jan 07
  • 1650 posts

Posted 14 May 2014 - 11:24 PM #46

kingsleypress, here are a few of the other things we did:
1) Eliminate as many of the external javascripts as possible. We found that some of the javascripts provided by 3rd party vendors were not only just an ad for them, but many of them did not zip or compress them.
2) We clicked on the images and downloaded the optimized images that GTMetrix was suggesting. These don't show in the yslow, but for some reason when I changed some of the primary images to what they were suggesting it helped the page load and yslow too.
3) Sadly we found that Searchanise negatively effected the speed of our site. Not only does it add another DNS lookup, but their images did not seem to optimized and it makes another script that is pulled from a different domain. Right now we are using the quick search from the alt-team, and while it still needs a little work on the cosmetic side, it seems to load faster on our site and customers can still find things. Plus it kept adding negative hits in the "Add Expires headers" area.

I still have not figure out the "Use cookie-free domains" that showed in your image here. Neither have we figured out how to "Defer parsing of JavaScript" that is the first page report.

I would guess that if you turned off Searchanise alone you would probably bump your yslow up to a "B".
Regards,
Jim

 

Posted 14 May 2014 - 11:49 PM #47

Has anyone figured out how to resolve this?

"Defer parsing of JavaScript"

Elkhorn Graphics LLC
Cs-Cart 4.7.1  SP3


 

Posted 15 May 2014 - 12:00 AM #48

Its interesting that I cannot use others versions of .htaccess.. It either crashes our site or gets very poor results with GTmetrix..
This seems to be what works for us. We are getting 94% - 84% on the homepage
Searchanise was killing out site speed. (turned off) And others like Bizrate badge dragging it down.
As for pages without the badges getting 94% - 88%

This is only a portion of our .htaccess
<FilesMatch .*\.css.gz$>
		<IfModule mod_expires.c>
			Header unset ETag
			FileETag None
			ExpiresActive On
			ExpiresDefault "access plus 1 year"
		</IfModule>
			ForceType text/css
			Header set Content-Encoding: gzip
			Header set Cache-control: private
	</FilesMatch>
	<FilesMatch .*\.js.gz$>
		<IfModule mod_expires.c>
			Header unset ETag
			FileETag None
			ExpiresActive On
			ExpiresDefault "access plus 1 year"
		</IfModule>
			ForceType text/javascript
			Header set Content-Encoding: gzip
			Header set Cache-control: private
	</FilesMatch>

<FilesMatch "\.(ttf|ttc|otf|eot|woff|css)$">
  Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
<IfModule mod_expires.c>
  Header append Vary: Accept-Encoding
  Header unset ETag
  FileETag None
  ExpiresActive On
  ExpiresDefault "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/jpg "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType text/html "access plus 1 day"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType application/x-javascript "access plus 1 year"
</IfModule>

Elkhorn Graphics LLC
Cs-Cart 4.7.1  SP3


 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 814 posts

Posted 15 May 2014 - 04:11 PM #49

@KingsleyPress I looked you up on GTMetrix and the details of your report show that what is dropping your score is the 3rd party JS files from Searchanise, GeoTrust and ChatServer and Google.
There's nothing you can do about that other than to stop using those services.
The good news is that your site is responding pretty fast - even if the GTMetrix score is not the best.
You could pick up more speed by optimizing the images that the report recommends - but I haven't done that either.

CS-Cart Ultimate ver 4.3.5


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11320 posts

Posted 15 May 2014 - 06:29 PM #50

why not just embed those connections inside a document.ready anonymous function so they won't run till after the page loads.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 

Posted 15 May 2014 - 06:49 PM #51

why not just embed those connections inside a document.ready anonymous function so they won't run till after the page loads.


Because I don't know how. :-)
You should write an add-on for us! :-)

 

Posted 15 May 2014 - 07:07 PM #52

why not just embed those connections inside a document.ready anonymous function so they won't run till after the page loads.


Would also like to know how to do this..

Elkhorn Graphics LLC
Cs-Cart 4.7.1  SP3


 

Posted 15 May 2014 - 07:16 PM #53

@KingsleyPress I looked you up on GTMetrix and the details of your report show that what is dropping your score is the 3rd party JS files from Searchanise, GeoTrust and ChatServer and Google.
There's nothing you can do about that other than to stop using those services.
The good news is that your site is responding pretty fast - even if the GTMetrix score is not the best.
You could pick up more speed by optimizing the images that the report recommends - but I haven't done that either.


Thanks for looking at this for me Don. I really appreciate your helpfulness.

I might try disabling Searchanise and using the Alt-Team alternative that Clips mentioned. Do I need to just disable the Searchanise add-on, or do I need to also uninstall it?

Which service of Google's would that be, Google Analytics?

 
  • clips
  • Aged Resident Loon
  • Members
  • Join Date: 14-Jan 07
  • 1650 posts

Posted 15 May 2014 - 07:34 PM #54

why not just embed those connections inside a document.ready anonymous function so they won't run till after the page loads.

Interesting...

On the Searchanise, you can just disable it to see if the results change. Then you will have a better idea which way you may want to know. There have been some who have said Seachanise did not affect their page load. On our site we know that it affected it negatively. Since I was using their free option, I"m not for sure if the paid option would run any better or not.
Regards,
Jim

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11320 posts

Posted 15 May 2014 - 08:56 PM #55

Well, assuming that you are using all of them in a index/scripts.post.tpl hook, I would try something like:
<script type="text/javascript" async>
$.document.ready( function() {$ldelim}
// Your scripts here using appropriate literal tags where necessary
{$rdelim} );
</script>
No idea whether this will make a difference for you or not.

Alternatively, instead of using the hook, you could just add your script to a
js/addons/my_changes/vendor_func.js
file and then have your hook content just be:
{script src="js/addons/my_changes/vendor_func.js"}

The advantage of the latter is that it reduces your page load time/size after the first load (but this won't help your reported times). But for small tracking scripts, it isn't really necessary. The disadvantage is that you have to clear the cache or recreate the cache to get your changes visible.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 

Posted 16 May 2014 - 01:44 AM #56

OK so I uninstalled Searchanise and purchased the Quick Search add on from Alt Team.

I now have an A, B score from GTMetrix (was A, C).

 
  • clips
  • Aged Resident Loon
  • Members
  • Join Date: 14-Jan 07
  • 1650 posts

Posted 16 May 2014 - 02:06 AM #57

OK so I uninstalled Searchanise and purchased the Quick Search add on from Alt Team.

I now have an A, B score from GTMetrix (was A, C).

Fairly simple to increase the speed a little. Hopefully Searchanise will be able to fix what slows down sites that use them. Again, if you have the paid version of Searchanise I'm not for sure if it is lighter or not.

On the Alt-Team search in my opinion the only things that would make it better is if there was an easy edit on what the drop down looked like (Searchanise is better on this part) and also if they "squared off" the bottom of the drop down where they put the "view all". Other than that it works fine so far for us.
Regards,
Jim

 

Posted 16 May 2014 - 11:47 AM #58

Fairly simple to increase the speed a little. Hopefully Searchanise will be able to fix what slows down sites that use them. Again, if you have the paid version of Searchanise I'm not for sure if it is lighter or not.

On the Alt-Team search in my opinion the only things that would make it better is if there was an easy edit on what the drop down looked like (Searchanise is better on this part) and also if they "squared off" the bottom of the drop down where they put the "view all". Other than that it works fine so far for us.


Yes, I agree that the Alt-Team's Quick Search could use some cosmetic touching up to make it look nicer. Maybe they will release an update. They need to at least add a little padding in places so that everything is not slammed up against each other. Often you find though that good programmers don't have a good eye for cosmetic appearance. It works for now.

 

Posted 16 May 2014 - 04:34 PM #59

One more quick post on this:

I removed Searchanise as mentioned above.
I disabled the GeoTrust badge...but it made no difference...so I enabled it again.

I have also now removed the code for the Chat software. This did not make any difference to the YSlow grade...still a B.

One thing to note, though, is that since removing Searchanise and the Chat software, page load times have gone UP, instead of down. Page load time is now up to 6.25 seconds. How can that be right?

 
  • snorocket
  • Forum Janitor
  • Members
  • Join Date: 15-Mar 06
  • 2519 posts

Posted 17 May 2014 - 01:31 AM #60

These are the 6 items you need to focus on:
Leverage browser caching
Minify JavaScript
Optimize images
Minify CSS
Use Amazon CloudFront CDN
Server response time slow

We had to manually minify js, css and batch optimize the images. Their are several pieces of software available to batch optimize images all in just a few clicks. Get rid of anything calling external links including badges and social buttons. Chat and Searchanise have to go for sure. Use Amazon CloudFront CDN and if the server response time is still slow after all this then either upgrade and or switch to a new server - Sno
SNOROCKET.COM, Now Accepting PRE-ORDERS:
Customer Service (Helpdesk) Addon for CS-Cart v4.3.1
Quote and Invoicing Addon for CS-Cart v4.3.1