Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Low-Cal Vanilla
Low-Cal Vanilla
0
Comments
edit: No issues so far, think the pages are loading faster.
How does this work?
Absolutely incredible, it's like I've doubled the speed of my broadband connection!
I hope it's not a coincidence!
Posted: Sunday, 26 August 2007 at 12:56PM
you are using the ob_get_contents, ob_end_flush and so on commands, they are *really* slow
try something like
if(strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) { /* header stuff? don't know right now, sry */ echo gzencode($content); } else echo $content;
you can use microtime(true); to compare times.
The function returns milliseconds (as float), so run it before and after the block, substract the times and compare to gzencode
class LowCalVanilla extends Control { function Render() { $t1 = microtime(true); // This is only defined if gunzip extension is installed if ( defined('FORCE_GZIP') && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false ) { // Get the content of the page $content = ob_get_contents(); ob_clean(); echo gzencode($content); header('Vary: Accept-Encoding'); header('Content-Encoding: gzip'); header('Content-Length: ' . ob_get_length()); $t2 = microtime(true); $t = $t2 - $t1; header('Time: ' . $t); } } function LowCalVanilla(&$Context) { $this->Name = 'LowCalVanilla'; $this->Control($Context); } }
And the result is similar.
Update:
New version:
Time=0.000478029251099
Time=0.000461101531982
Time=0.000349044799805
Time=0.000463962554932
Time=0.000473976135254
Previous:
Time=0.000494003295898
Time=0.000475883483887
Time=0.000339984893799
Time=0.000487089157104
Time=0.000330924987793
Server=Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.3
Windows vista Intel Core 2 6600 @ 2.40 GHz; 2GB of RAM
Why isn't whatever it does on by default?
Even Mac Firefox is actually fast with this!
As AlexL asks, is this a server thing or a PHP setting?
Posted: Thursday, 30 August 2007 at 2:00PM
For this addon, it's php who compress the output. You need to have the zlib php extension installed. The addon check it is installed.
You should always check your pages are not already encoded before installing the add-on:
eg, use the Web Developer toolbar and check for "Content-Encoding: gzip" for the response header (Web Developer > Information > View response header) and the pages size (Web Developer > Information > View Document Size - check if it gives you a compressed size and an uncompressed size for the document).
There is also these problem with some versions of IE:
$_SERVER['HTTP_USER_AGENT']
http://www.zytrax.com/tech/web/browser_ids.htm#msie