Gzipping JS + CSS Files

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-09-2007, 11:55 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 537
Warning, this might break your installation. It is for testing purposes only!

I recently came back to looking at pligg, and Beta 9 seems to be to be slower than previous versions. Having run a few checks, it was obvious why:
Quote:
HTTP Requests: 65
Size: 177kb
Time: 11.60s (ISDN) / 1.74s (T1)
So, i starting gzipping files. First css, then scriptaculous javascript files, and finally general gzip in htaccess. The results thus far:
Quote:
HTTP Requests: 16
Size: 39kb
Time: 3.20s (ISDN) / 1.01s (T1)
This is using default installation, on the digitalnature template only, with no other modules installed. Brief testing has been carried out, and the main user functions appear to still be working. Load times have dropped dramatically.

Remember, this may break pligg functions! It is not fully tested, I just wanted to say whether i could make pligg load faster. With over 100kb of javascript, 65 HTTP requests, and no stories on the main page, i was a bit concerned about loading. The files (changed and original) are attached below with some basic instructions, if anyone wants to play with them in a test environment.

Demo using gzipped files: http://news.oioplus.com

Update: v1.03 - uses zlib to compress all gzip and js files, uses scriptaculous 1.65


PS. totally unrelated, but if anyone is thinking of / has started a vBulletin bridge, i'd be interested in hearing from you!
Attached Files
File Type: zip pligg-gzip 1.03.zip (157.5 KB, 87 views)

Last edited by Simon; 01-11-2007 at 09:18 PM.
Reply With Quote
  #2 (permalink)  
Old 01-10-2007, 12:04 AM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
I will definitely take a look at this. Thanks.
Reply With Quote
  #3 (permalink)  
Old 01-10-2007, 12:11 AM
Constant Pligger
 
Join Date: Mar 2006
Posts: 537
No problem. First thing i've noticed that doesn't work is the editnplace function. So, it may take a bit of trial and error to find the best balance.

EDIT: fixed, the file scriptaculous.js needed an edit (to add the .gz extention). Also, the file editnplace.js won't work if gzipped. So far, the rest of the functions appear to be working. Updated zip file to v1.01

Last edited by Simon; 01-10-2007 at 12:41 AM.
Reply With Quote
  #4 (permalink)  
Old 01-10-2007, 04:21 AM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,181
it's good your back hehe.

page loaded in 0.594s. my local copy takes 1.5s to load. nice work
Reply With Quote
  #5 (permalink)  
Old 01-10-2007, 09:52 AM
Constant Pligger
 
Join Date: Mar 2006
Posts: 537
Quote:
Originally Posted by savant View Post
it's good your back hehe.
Well i couldn't live without pligg forever!
Reply With Quote
  #6 (permalink)  
Old 01-10-2007, 12:44 PM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
Simon, how do we check to see if mod_gzip is enabled? i skimmed the httpd.conf file for it and didn't see it. The reason I ask is because I am testing the latest attachment and my sidebar has dissapeared. This is usually caused by some conflicting javascript but I was going to check with the mod_gzip first.
Reply With Quote
  #7 (permalink)  
Old 01-10-2007, 04:19 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 537
Error on my part, the htaccess file i put in the zip uses zlib, not mod_gzip. If you load phpinfo() on your server, scroll down to "zlib"and look for the row "ZLib Support".

It is probably a js conflict though. I changed 2 js files in the v1.01 update - prototype.js and scriptaculous.js - so you might want to try reverting them. If you revert scriptaculous you'll need to use the uncompressed versions of the files it calls (effects.js etc), since only the modded version called the compressed files.

Last edited by Simon; 01-11-2007 at 09:02 PM.
Reply With Quote
  #8 (permalink)  
Old 01-11-2007, 09:20 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 537
Updated files in first post to v1.03 - now uses zlib to compress all files to increase compatibility with user browsers (and servers that dont have mod_gzip or mod_deflate installed).
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracted .tar files still zipped and unavailable tihwp Questions and Comments 2 05-18-2009 12:33 AM
What's better? Multiple CSS files or on huge file? Unknown Questions and Comments 1 01-07-2008 10:53 PM
After host move: cashed files are 0bytes, site BROKE ! tarekeldeeb Questions and Comments 1 07-11-2007 03:49 PM
my template files unohoo Questions and Comments 4 10-14-2006 06:57 AM
.tpl files & smarty codes explained 3dKiller Questions and Comments 0 04-11-2006 01:52 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development