| | |
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
![]() |
•
•
Join Date: Oct 2009
Posts: 23
Reputation:
Solved Threads: 0
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?
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?
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
css and javascripts respond well to gzip,
example: in the include file creates your <head>
change references to 'style.css' to 'style.css.php'
likewise script.js can be script.js.php with
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
php Syntax (Toggle Plain Text)
<?php ob_start("ob_gzhandler"); ob_flush(); ?>
example: in the include file creates your <head>
change references to 'style.css' to 'style.css.php'
php Syntax (Toggle Plain Text)
<?php header ('content-type:text/css'); ob_start("ob_gzhandler"); ?>/*<style>*/ .rss-box { margin:1em 3%; padding:4px 8px; background-color:#ededed; border:2px dashed #7485CA; } .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; } /* bla bla bla */ <?php ob_flush(); ?>
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
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
![]() |
Similar Threads
- Best File Compression Software? (Windows Software)
- Re: Windows XP 64-bit issues (Windows NT / 2000 / XP)
- Someone who wants to learn C++ with me? (C++)
- Python speed ! (Python)
- C++ advice (scanf/printf) (C++)
- Out with the old... or back to the old? HELP (Motherboards, CPUs and RAM)
- Which Browser? threads aren´t specific (IT Professionals' Lounge)
- 333FSB with 400mhz memory? (Motherboards, CPUs and RAM)
- Networking an iBook and a WindowsXP machine wirelessley (OS X)
- Cannot use download accelerator on network (Networking Hardware Configuration)
Other Threads in the Site Layout and Usability Forum
- Previous Thread: Web layouts in photoshop
- Next Thread: Cross browser woes
Views: 925 | Replies: 2
| Thread Tools | Search this Thread |






