Webpage compression: real speed gain?

Please support our Site Layout and Usability advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Oct 2009
Posts: 23
Reputation: raigs is an unknown quantity at this point 
Solved Threads: 0
raigs raigs is offline Offline
Newbie Poster

Webpage compression: real speed gain?

 
0
  #1
Oct 29th, 2009
My website is programmed in PHP and currently uses HTTP compression (gzip) using PHP's built-in compression functions. (I cannot use mod_deflate.c because my shared hosting provider will not install it because it would use a lot of CPU.) The shared server where my website is hosted currently hosts 100 other websites. I have programmed the html and css quite efficiently and there is not much room to rewrite the same thing with less markup. My images are already compressed.

My question is whether using PHP's compression actually is faster for the user than sending it uncompressed.
1. The CPU compresses the output, sends the output to the browser and the browser has to decompress it. (Compression functions use considerable CPU on both computers.)
2. Send the output uncompressed. (Saves CPU but sends more data.)

Is it worth it to compress my webpages if each consist of 20kb of html/css and 30kb of images?
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 15
Reputation: adamramadhan is an unknown quantity at this point 
Solved Threads: 0
adamramadhan adamramadhan is offline Offline
Newbie Poster
 
0
  #2
Oct 30th, 2009
well its a choice either bandwidth or ram usage .
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,393
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 168
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso
 
0
  #3
Oct 30th, 2009
make yourself a page
a really enormous wad of text
images are insignificant as jpg and png are already optimized and nobody should be bmp-ing
make 2
one with gzip enabled, one without
compare load times
run both through http://www.websiteoptimization.com/services/analyze/ to see the difference
I find a huge speed differential in favoour of
  1. <?php ob_start("ob_gzhandler");
  2. ob_flush(); ?>
css and javascripts respond well to gzip,
example: in the include file creates your <head>
change references to 'style.css' to 'style.css.php'
  1. <?php header ('content-type:text/css');
  2. ob_start("ob_gzhandler"); ?>/*<style>*/
  3. .rss-box { margin:1em 3%; padding:4px 8px; background-color:#ededed; border:2px dashed #7485CA; }
  4. .rss-title, rss-title a { font-family:"American Typewriter", "Trebuchet MS", Trebuchet, Lucida, sans-serif; font-size:100%; font-weight:bold; margin:5px 0; padding:0; letter-spacing:1px; }
  5. /* bla bla bla */
  6. <?php ob_flush(); ?>
likewise script.js can be script.js.php with content-type:text/javascript and gzip enabled
Last edited by almostbob; Oct 30th, 2009 at 9:06 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Site Layout and Usability Forum


Views: 925 | Replies: 2
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC