require_once ("../phpwee.php"); $html = file_get_contents("http://en.wikipedia.org/wiki/Minification_%28programming%29"); $minified = PHPWee\Minify::html($html); echo print_performance_graph("Wikipedia",$minified,$html); /* $html = file_get_contents("http://www.codeproject.com/Articles/759094/Step-by-Step-PHP-Tutorials-for-Beginners-Creating"); $minified = PHPWee\Minify::html($html); echo print_performance_graph("The Code Project",$minified,$html); $html = file_get_contents("https://github.com/php/php-src"); $minified = PHPWee\Minify::html($html); print_performance_graph("GiHub",$minified,$html); $html = file_get_contents("http://www.w3schools.com/php/"); $minified = PHPWee\Minify::html($html); print_performance_graph("W3Schools",$minified,$html); $html = file_get_contents("http://searchturbine.com"); $minified = PHPWee\Minify::html($html); print_performance_graph("SearchTurbine",$minified,$html); */ /////////////////////////////////////////////////////////////// function print_performance_graph($subject,$minified,$html){ $before = strlen(gzcompress($html)); $after = strlen(gzcompress($minified)); $improvement = 100 * (1-($after/$before)); echo "
$subject | ||
---|---|---|
Gzipped Bytes Before PHPWee | Gzipped Bytes After PHPWee | % Performance Boost |
$before before | $after after | $improvement % faster |