mirror of
https://github.com/mrclay/minify.git
synced 2025-08-15 02:24:13 +02:00
ab_tests/ : + test for /min (and reran)
examples : cleanup - examples/3 - jquery-1.2.3.js (unneeded duplicate)
This commit is contained in:
@@ -1,28 +1,38 @@
|
|||||||
Document Path: /_3rd_party/minify/web/ab_tests/ideal_php/before.php
|
Document Path: /min_extras/ab_tests/ideal_php/before.php
|
||||||
Document Length: 15993 bytes
|
Document Length: 15993 bytes
|
||||||
Requests per second: 429.53 [#/sec] (mean)
|
Requests per second: 415.58 [#/sec] (mean)
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Document Path: /_3rd_party/minify/web/ab_tests/v1.0/minify.php?files=before.js
|
Document Path: /min_extras/ab_tests/v1.0/minify.php?files=before.js
|
||||||
Document Length: 54159 bytes
|
Document Length: 54159 bytes
|
||||||
Requests per second: 299.07 [#/sec] (mean)
|
Requests per second: 275.86 [#/sec] (mean)
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Document Path: /_3rd_party/minify/web/ab_tests/minify/test_Files.php
|
Document Path: /min_extras/ab_tests/minify/test_Files.php
|
||||||
Document Length: 15993 bytes
|
Document Length: 15993 bytes
|
||||||
Requests per second: 243.81 [#/sec] (mean)
|
(Connect: 0, Length: 4, Exceptions: 0)
|
||||||
|
Requests per second: 239.70 [#/sec] (mean)
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Document Path: /_3rd_party/minify/web/ab_tests/minify/test_Groups.php/test
|
Document Path: /min_extras/ab_tests/minify/test_Groups.php/test
|
||||||
Document Length: 15993 bytes
|
Document Length: 15993 bytes
|
||||||
Requests per second: 225.35 [#/sec] (mean)
|
(Connect: 0, Length: 2, Exceptions: 0)
|
||||||
|
Requests per second: 204.15 [#/sec] (mean)
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Document Path: /_3rd_party/minify/web/ab_tests/minify/test_Version1.php?files=before.js
|
Document Path: /min_extras/ab_tests/minify/test_Version1.php?files=before.js
|
||||||
Document Length: 15993 bytes
|
Document Length: 15993 bytes
|
||||||
Requests per second: 234.43 [#/sec] (mean)
|
(Connect: 0, Length: 2, Exceptions: 0)
|
||||||
|
Requests per second: 233.58 [#/sec] (mean)
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Document Path: /_3rd_party/minify/web/ab_tests/mod_deflate/before.js
|
Document Path: /min/?f=min_extras/ab_tests/minify/before.js
|
||||||
|
Document Length: 15993 bytes
|
||||||
|
(Connect: 0, Length: 1, Exceptions: 0)
|
||||||
|
Requests per second: 246.63 [#/sec] (mean)
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
Document Path: /min_extras/ab_tests/mod_deflate/before.js
|
||||||
Document Length: 16053 bytes
|
Document Length: 16053 bytes
|
||||||
Requests per second: 189.07 [#/sec] (mean)
|
(Connect: 0, Length: 1, Exceptions: 0)
|
||||||
|
Requests per second: 191.04 [#/sec] (mean)
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Document Path: /_3rd_party/minify/web/ab_tests/type-map/before.js.var
|
Document Path: /min_extras/ab_tests/type-map/before.js.var
|
||||||
Document Length: 15993 bytes
|
Document Length: 15993 bytes
|
||||||
Requests per second: 503.94 [#/sec] (mean)
|
(Connect: 0, Length: 1, Exceptions: 0)
|
||||||
|
Requests per second: 518.22 [#/sec] (mean)
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@@ -1,9 +1,13 @@
|
|||||||
@SET PATH=%PATH%;C:\xampp\apache\bin
|
@SET PATH=%PATH%;C:\xampp\apache\bin
|
||||||
|
|
||||||
::SET ABCALL=ab -d -S -c 100 -n 2000 -H "Accept-Encoding: deflate, gzip" http://localhost
|
@SET DOMAIN=http://mc.dev
|
||||||
@SET ABCALL=ab -d -S -c 100 -n 2000 -H "Accept-Encoding: deflate, gzip" http://mc.dev/_3rd_party
|
|
||||||
|
|
||||||
::SET TXTVIEWER=notepad.exe
|
::@SET ABCALL=ab -d -S -c 100 -n 2000 -H "Accept-Encoding: deflate, gzip" http://localhost
|
||||||
|
@SET ABCALL=ab -d -S -c 100 -n 2000 -H "Accept-Encoding: deflate, gzip"
|
||||||
|
|
||||||
|
@SET ABTESTS=%DOMAIN%/min_extras/ab_tests
|
||||||
|
|
||||||
|
::@SET TXTVIEWER=notepad.exe
|
||||||
@SET TXTVIEWER="C:\Program Files\Notepad++\notepad++.exe"
|
@SET TXTVIEWER="C:\Program Files\Notepad++\notepad++.exe"
|
||||||
|
|
||||||
@SET DELIM=TYPE _delimiter
|
@SET DELIM=TYPE _delimiter
|
||||||
@@ -11,31 +15,35 @@
|
|||||||
DEL results.txt
|
DEL results.txt
|
||||||
|
|
||||||
:: baseline PHP
|
:: baseline PHP
|
||||||
%ABCALL%/minify/web/ab_tests/ideal_php/before.php >> results.txt
|
%ABCALL% %ABTESTS%/ideal_php/before.php >> results.txt
|
||||||
@%DELIM% >> results.txt
|
@%DELIM% >> results.txt
|
||||||
|
|
||||||
:: 1.0 release
|
:: 1.0 release
|
||||||
%ABCALL%/minify/web/ab_tests/v1.0/minify.php?files=before.js >> results.txt
|
%ABCALL% %ABTESTS%/v1.0/minify.php?files=before.js >> results.txt
|
||||||
@%DELIM% >> results.txt
|
@%DELIM% >> results.txt
|
||||||
|
|
||||||
:: Files controller
|
:: Files controller
|
||||||
%ABCALL%/minify/web/ab_tests/minify/test_Files.php >> results.txt
|
%ABCALL% %ABTESTS%/minify/test_Files.php >> results.txt
|
||||||
@%DELIM% >> results.txt
|
@%DELIM% >> results.txt
|
||||||
|
|
||||||
:: Groups controller
|
:: Groups controller
|
||||||
%ABCALL%/minify/web/ab_tests/minify/test_Groups.php/test >> results.txt
|
%ABCALL% %ABTESTS%/minify/test_Groups.php/test >> results.txt
|
||||||
@%DELIM% >> results.txt
|
@%DELIM% >> results.txt
|
||||||
|
|
||||||
:: Version1 controller
|
:: Version1 controller
|
||||||
%ABCALL%/minify/web/ab_tests/minify/test_Version1.php?files=before.js >> results.txt
|
%ABCALL% %ABTESTS%/minify/test_Version1.php?files=before.js >> results.txt
|
||||||
|
@%DELIM% >> results.txt
|
||||||
|
|
||||||
|
::/min application
|
||||||
|
%ABCALL% %DOMAIN%/min/?f=min_extras/ab_tests/minify/before.js >> results.txt
|
||||||
@%DELIM% >> results.txt
|
@%DELIM% >> results.txt
|
||||||
|
|
||||||
:: mod_deflate
|
:: mod_deflate
|
||||||
%ABCALL%/minify/web/ab_tests/mod_deflate/before.js >> results.txt
|
%ABCALL% %ABTESTS%/mod_deflate/before.js >> results.txt
|
||||||
@%DELIM% >> results.txt
|
@%DELIM% >> results.txt
|
||||||
|
|
||||||
:: type-map
|
:: type-map
|
||||||
%ABCALL%/minify/web/ab_tests/type-map/before.js.var >> results.txt
|
%ABCALL% %ABTESTS%/type-map/before.js.var >> results.txt
|
||||||
@%DELIM% >> results.txt
|
@%DELIM% >> results.txt
|
||||||
|
|
||||||
FINDSTR "Path: Length: Requests --" results.txt > results_summary.txt
|
FINDSTR "Path: Length: Requests --" results.txt > results_summary.txt
|
||||||
|
@@ -13,5 +13,5 @@ ini_set('include_path',
|
|||||||
* Set $minifyCachePath to a PHP-writeable path to enable server-side caching
|
* Set $minifyCachePath to a PHP-writeable path to enable server-side caching
|
||||||
* in all examples and tests.
|
* in all examples and tests.
|
||||||
*/
|
*/
|
||||||
$minifyCachePath = 'C:/xampp/tmp'; // '';
|
$minifyCachePath = '';
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
$base = realpath(dirname(__FILE__) . '/..');
|
$base = realpath(dirname(__FILE__) . '/..');
|
||||||
$groupsSources = array(
|
$groupsSources = array(
|
||||||
'js' => array(
|
'js' => array(
|
||||||
"{$base}/jquery-1.2.3.js"
|
"{$base}/lib.js"
|
||||||
,"{$base}/test space.js"
|
,"{$base}/test space.js"
|
||||||
)
|
)
|
||||||
,'css' => array("{$base}/test.css")
|
,'css' => array("{$base}/test.css")
|
||||||
|
@@ -18,8 +18,8 @@ $cssBuild = new Minify_Build($groupsSources['css']);
|
|||||||
|
|
||||||
<?php if (! $minifyCachePath): ?>
|
<?php if (! $minifyCachePath): ?>
|
||||||
<p><strong>Note:</strong> You should <em>always</em> enable caching using
|
<p><strong>Note:</strong> You should <em>always</em> enable caching using
|
||||||
<code>Minify::useServerCache()</code>. For the examples this can be set in
|
<code>Minify::setCache()</code>. For the examples this can be set in
|
||||||
<code>config.php</code>. Notice that minifying jQuery takes several seconds!.</p>
|
<code>config.php</code>.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<h1>Minify Example 1 : Groups controller + Far-off Expires header</h1>
|
<h1>Minify Example 1 : Groups controller + Far-off Expires header</h1>
|
||||||
@@ -40,7 +40,10 @@ changed in the HTML document, causing the browser to request a new version.</p>
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>Test client cache</h2>
|
<h2>Test client cache</h2>
|
||||||
<p><a href="">Reload page</a> <small>(F5 can trigger no-cache headers)</small></p>
|
<p>When you <a href="">click here</a> to reload the page, your browser should
|
||||||
|
not have to re-download the minified files.</p>
|
||||||
|
|
||||||
|
<p style='text-align:right'><a href="../2/">example 2 »</a></p>
|
||||||
|
|
||||||
<script type="text/javascript" src="<?php echo $jsBuild->uri('m.php/js'); ?>"></script>
|
<script type="text/javascript" src="<?php echo $jsBuild->uri('m.php/js'); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
$base = realpath(dirname(__FILE__) . '/..');
|
$base = realpath(dirname(__FILE__) . '/..');
|
||||||
$groupsSources = array(
|
$groupsSources = array(
|
||||||
'js' => array(
|
'js' => array(
|
||||||
"{$base}/jquery-1.2.3.js"
|
"{$base}/lib.js"
|
||||||
,"{$base}/test space.js"
|
,"{$base}/test space.js"
|
||||||
)
|
)
|
||||||
,'css' => array("{$base}/test.css")
|
,'css' => array("{$base}/test.css")
|
||||||
|
@@ -26,8 +26,8 @@ ob_start();
|
|||||||
|
|
||||||
<?php if (! $minifyCachePath): ?>
|
<?php if (! $minifyCachePath): ?>
|
||||||
<p><strong>Note:</strong> You should <em>always</em> enable caching using
|
<p><strong>Note:</strong> You should <em>always</em> enable caching using
|
||||||
<code>Minify::useServerCache()</code>. For the examples this can be set in
|
<code>Minify::setCache()</code>. For the examples this can be set in
|
||||||
<code>config.php</code>. Notice that minifying jQuery takes several seconds!.</p>
|
<code>config.php</code>.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<h1>Minify Example 2: Minifying <em>Everything</em></h1>
|
<h1>Minify Example 2: Minifying <em>Everything</em></h1>
|
||||||
@@ -40,6 +40,9 @@ elements.</p>
|
|||||||
<p>As the document is XHTML, Minify_HTML places the 2nd <code><script></code>
|
<p>As the document is XHTML, Minify_HTML places the 2nd <code><script></code>
|
||||||
element in a CDATA section because it contains "<". The output is valid XHTML.</p>
|
element in a CDATA section because it contains "<". The output is valid XHTML.</p>
|
||||||
|
|
||||||
|
<h2><a href="http://validator.w3.org/check/referer"
|
||||||
|
onclick="this.target='_blank'">Validate XHTML</a></h2>
|
||||||
|
|
||||||
<h2>Minify tests</h2>
|
<h2>Minify tests</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li id="cssFail"><span>FAIL</span>PASS</li>
|
<li id="cssFail"><span>FAIL</span>PASS</li>
|
||||||
@@ -48,16 +51,21 @@ element in a CDATA section because it contains "<". The output is valid XHTML
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>Test client cache</h2>
|
<h2>Test client cache</h2>
|
||||||
<p><a href="">Reload page</a> <small>(F5 can trigger no-cache headers)</small></p>
|
<p>When you <a href="">click here</a> to reload the page, your browser should
|
||||||
|
not have to re-download any files.</p>
|
||||||
|
|
||||||
|
<p style='text-align:right'><a href="../../">extras index »</a></p>
|
||||||
|
|
||||||
<script type="text/javascript" src="<?php echo $jsBuild->uri('m.php/js'); ?>"></script>
|
<script type="text/javascript" src="<?php echo $jsBuild->uri('m.php/js'); ?>"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(function () {
|
var wo = window.onload;
|
||||||
|
window.onload = function () {
|
||||||
|
wo && wo();
|
||||||
if ( 1 < 2 ) {
|
if ( 1 < 2 ) {
|
||||||
$('#jsFail2').html('PASS');
|
html('jsFail2', 'PASS');
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
require '../../config.php';
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<title>Minify Example 3</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="m.php?f=test.css" />
|
|
||||||
<style type="text/css">#cssFail {width:2.8em; overflow:hidden;}</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<?php if (! $minifyCachePath): ?>
|
|
||||||
<p><strong>Note:</strong> You should <em>always</em> enable caching using
|
|
||||||
<code>Minify::useServerCache()</code>. For the examples this can be set in
|
|
||||||
<code>config.php</code>. Notice that minifying jQuery takes several seconds!.</p>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<h1>Minify Example 3: Files controller</h1>
|
|
||||||
|
|
||||||
<p>This is an example of Minify serving a directory of single css/js files.
|
|
||||||
Each file is minified and sent with HTTP encoding (browser-permitting).</p>
|
|
||||||
|
|
||||||
<h2>Minify tests</h2>
|
|
||||||
<ul>
|
|
||||||
<li id="cssFail"><span>FAIL</span>PASS</li>
|
|
||||||
<li id="jsFail1">FAIL</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2>Test client cache</h2>
|
|
||||||
<p><a href="">Reload page</a> <small>(F5 can trigger no-cache headers)</small></p>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="m.php?f=jquery-1.2.3.js"></script>
|
|
||||||
<script type="text/javascript" src="m.php?f=test+space.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -1,44 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This script will serve a single js/css file in this directory. Here we place
|
|
||||||
* the front-end-controller logic in user code, then use the "Files" controller
|
|
||||||
* to minify the file. Alternately, we could have created a custom controller
|
|
||||||
* with the same logic and passed it to Minify::handleRequest().
|
|
||||||
*/
|
|
||||||
|
|
||||||
require '../../config.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Files controller only "knows" HTML, CSS, and JS files. Other files
|
|
||||||
* would only be trim()ed and sent as plain/text.
|
|
||||||
*/
|
|
||||||
$serveExtensions = array('css', 'js');
|
|
||||||
|
|
||||||
// serve
|
|
||||||
if (isset($_GET['f'])) {
|
|
||||||
$filename = basename($_GET['f']); // remove any naughty bits
|
|
||||||
$filenamePattern = '/[^\'"\\/\\\\]+\\.(?:'
|
|
||||||
.implode('|', $serveExtensions). ')$/';
|
|
||||||
|
|
||||||
if (preg_match($filenamePattern, $filename)
|
|
||||||
&& file_exists(dirname(__FILE__) . '/../' . $filename)) {
|
|
||||||
|
|
||||||
require 'Minify.php';
|
|
||||||
|
|
||||||
if ($minifyCachePath) {
|
|
||||||
Minify::setCache($minifyCachePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The Files controller can serve an array of files, but here we just
|
|
||||||
// need one.
|
|
||||||
Minify::serve('Files', array(
|
|
||||||
// controller will cast a string to an array for you
|
|
||||||
'files' => dirname(__FILE__) . '/../' . $filename
|
|
||||||
));
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header("HTTP/1.0 404 Not Found");
|
|
||||||
echo "HTTP/1.0 404 Not Found";
|
|
3
min_extras/examples/index.php
Normal file
3
min_extras/examples/index.php
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
header('Location: 1/');
|
3408
min_extras/examples/jquery-1.2.3.js
vendored
3408
min_extras/examples/jquery-1.2.3.js
vendored
File diff suppressed because it is too large
Load Diff
6
min_extras/examples/lib.js
Normal file
6
min_extras/examples/lib.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
function html(id, html) {
|
||||||
|
|
||||||
|
document.getElementById(id).innerHTML = html;
|
||||||
|
|
||||||
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
$(function () {
|
window.onload = function () {
|
||||||
|
|
||||||
$('#jsFail1').html('PASS');
|
html('jsFail1', 'PASS');
|
||||||
|
|
||||||
});
|
};
|
@@ -90,7 +90,7 @@ function test_HTTP_Encoder()
|
|||||||
|
|
||||||
$variedContent = file_get_contents($thisDir . '/_test_files/html/before.html')
|
$variedContent = file_get_contents($thisDir . '/_test_files/html/before.html')
|
||||||
. file_get_contents($thisDir . '/_test_files/css/subsilver.css')
|
. file_get_contents($thisDir . '/_test_files/css/subsilver.css')
|
||||||
. file_get_contents($thisDir . '/../examples/jquery-1.2.3.js');
|
. file_get_contents($thisDir . '/../ab_tests/minify/before.js');
|
||||||
$variedLength = strlen($variedContent);
|
$variedLength = strlen($variedContent);
|
||||||
|
|
||||||
$encodingTests = array(
|
$encodingTests = array(
|
||||||
|
Reference in New Issue
Block a user