1
0
mirror of https://github.com/mrclay/minify.git synced 2025-04-21 21:01:54 +02:00

Default charset now UTF-8. Easier ab tests config.

This commit is contained in:
Steve Clay 2008-06-09 23:29:38 +00:00
parent 4c85da1fb3
commit bf935a9895
10 changed files with 45 additions and 223 deletions

View File

@ -82,8 +82,8 @@ class Minify {
*
* 'encodeLevel' : level of encoding compression (0 to 9, default 9)
*
* 'contentTypeCharset' : if given, this will be appended to the Content-Type
* header sent (needed mainly for HTML docs)
* 'contentTypeCharset' : appended to the Content-Type header sent. Set to a falsey
* value to remove. (default 'UTF-8')
*
* 'setExpires' : set this to a timestamp to have Minify send an HTTP Expires
* header instead of checking for conditional GET (default null).
@ -229,7 +229,7 @@ class Minify {
$headers['Content-Length'] = $cacheIsReady
? $cacheContentLength
: strlen($content);
$headers['Content-Type'] = (null !== self::$_options['contentTypeCharset'])
$headers['Content-Type'] = self::$_options['contentTypeCharset']
? self::$_options['contentType'] . '; charset=' . self::$_options['contentTypeCharset']
: self::$_options['contentType'];
if (self::$_options['encodeMethod'] !== '') {

View File

@ -44,7 +44,7 @@ abstract class Minify_Controller_Base {
,'encodeMethod' => null // determine later
,'encodeLevel' => 9
,'perType' => array() // no per-type minifier options
,'contentTypeCharset' => null // leave out of Content-Type header
,'contentTypeCharset' => 'UTF-8'
,'setExpires' => null // use conditional GET
,'quiet' => false // serve() will send headers and output

View File

@ -1,14 +1,11 @@
<?php
ini_set('include_path',
dirname(__FILE__) . '/../../../lib'
. PATH_SEPARATOR . ini_get('include_path')
);
require '../../config.php';
require 'Minify.php';
// give an explicit path to avoid having to load Solar/Dir.php
Minify::useServerCache('C:/WINDOWS/Temp');
Minify::useServerCache($minifyCachePath);
Minify::serve('Files', array(
'files' => array(

View File

@ -1,14 +1,11 @@
<?php
ini_set('include_path',
dirname(__FILE__) . '/../../../lib'
. PATH_SEPARATOR . ini_get('include_path')
);
require '../../config.php';
define('MINIFY_BASE_DIR', realpath(
dirname(__FILE__) . '/../minify'
));
define('MINIFY_CACHE_DIR', 'C:/xampp/tmp');
define('MINIFY_CACHE_DIR', $minifyCachePath);
require 'Minify.php';

View File

@ -1,204 +0,0 @@
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Apache/2.2.8
Server Hostname: localhost
Server Port: 80
Document Path: /minify/web/ab_tests/ideal_php/before.php
Document Length: 15993 bytes
Concurrency Level: 100
Time taken for tests: 3.234395 seconds
Complete requests: 2000
Failed requests: 0
Write errors: 0
Total transferred: 32794000 bytes
HTML transferred: 31986000 bytes
Requests per second: 618.35 [#/sec] (mean)
Time per request: 161.720 [ms] (mean)
Time per request: 1.617 [ms] (mean, across all concurrent requests)
Transfer rate: 9901.39 [Kbytes/sec] received
Connection Times (ms)
min avg max
Connect: 0 0 15
Processing: 46 155 656
Total: 46 155 671
--------------------------------------------------------------------------------
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Apache/2.2.8
Server Hostname: localhost
Server Port: 80
Document Path: /minify/web/ab_tests/v1.0/minify.php?files=before.js
Document Length: 54159 bytes
Concurrency Level: 100
Time taken for tests: 3.968775 seconds
Complete requests: 2000
Failed requests: 0
Write errors: 0
Total transferred: 108996000 bytes
HTML transferred: 108318000 bytes
Requests per second: 503.93 [#/sec] (mean)
Time per request: 198.439 [ms] (mean)
Time per request: 1.984 [ms] (mean, across all concurrent requests)
Transfer rate: 26819.61 [Kbytes/sec] received
Connection Times (ms)
min avg max
Connect: 0 0 15
Processing: 78 191 297
Total: 78 191 312
--------------------------------------------------------------------------------
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Apache/2.2.8
Server Hostname: localhost
Server Port: 80
Document Path: /minify/web/ab_tests/minify/test_Files.php
Document Length: 15993 bytes
Concurrency Level: 100
Time taken for tests: 4.875031 seconds
Complete requests: 2000
Failed requests: 0
Write errors: 0
Total transferred: 32764000 bytes
HTML transferred: 31986000 bytes
Requests per second: 410.25 [#/sec] (mean)
Time per request: 243.752 [ms] (mean)
Time per request: 2.438 [ms] (mean, across all concurrent requests)
Transfer rate: 6563.24 [Kbytes/sec] received
Connection Times (ms)
min avg max
Connect: 0 0 15
Processing: 46 236 328
Total: 46 236 343
--------------------------------------------------------------------------------
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Apache/2.2.8
Server Hostname: localhost
Server Port: 80
Document Path: /minify/web/ab_tests/minify/test_Version1.php?files=before.js
Document Length: 15993 bytes
Concurrency Level: 100
Time taken for tests: 5.609411 seconds
Complete requests: 2000
Failed requests: 0
Write errors: 0
Total transferred: 32872000 bytes
HTML transferred: 31986000 bytes
Requests per second: 356.54 [#/sec] (mean)
Time per request: 280.471 [ms] (mean)
Time per request: 2.805 [ms] (mean, across all concurrent requests)
Transfer rate: 5722.70 [Kbytes/sec] received
Connection Times (ms)
min avg max
Connect: 0 0 15
Processing: 46 272 891
Total: 46 272 906
--------------------------------------------------------------------------------
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Apache/2.2.8
Server Hostname: localhost
Server Port: 80
Document Path: /minify/web/ab_tests/mod_deflate/before.js
Document Length: 16053 bytes
Concurrency Level: 100
Time taken for tests: 11.328198 seconds
Complete requests: 2000
Failed requests: 0
Write errors: 0
Total transferred: 32994000 bytes
HTML transferred: 32106000 bytes
Requests per second: 176.55 [#/sec] (mean)
Time per request: 566.410 [ms] (mean)
Time per request: 5.664 [ms] (mean, across all concurrent requests)
Transfer rate: 2844.23 [Kbytes/sec] received
Connection Times (ms)
min avg max
Connect: 0 0 93
Processing: 62 547 1266
Total: 62 547 1359
--------------------------------------------------------------------------------
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Apache/2.2.8
Server Hostname: localhost
Server Port: 80
Document Path: /minify/web/ab_tests/type-map/before.js.var
Document Length: 15993 bytes
Concurrency Level: 100
Time taken for tests: 4.500029 seconds
Complete requests: 2000
Failed requests: 0
Write errors: 0
Total transferred: 32990000 bytes
HTML transferred: 31986000 bytes
Requests per second: 444.44 [#/sec] (mean)
Time per request: 225.001 [ms] (mean)
Time per request: 2.250 [ms] (mean, across all concurrent requests)
Transfer rate: 7159.06 [Kbytes/sec] received
Connection Times (ms)
min avg max
Connect: 0 0 15
Processing: 62 216 297
Total: 62 216 312
--------------------------------------------------------------------------------

View File

@ -0,0 +1,27 @@
Document Path: /_3rd_party/minify/web/ab_tests/ideal_php/before.php
Document Length: 15993 bytes
Requests per second: 445.99 [#/sec] (mean)
--------------------------------------------------------------------------------
Document Path: /_3rd_party/minify/web/ab_tests/v1.0/minify.php?files=before.js
Document Length: 54159 bytes
(Connect: 2, Length: 0, Exceptions: 0)
Requests per second: 300.47 [#/sec] (mean)
--------------------------------------------------------------------------------
Document Path: /_3rd_party/minify/web/ab_tests/minify/test_Files.php
Document Length: 15993 bytes
Requests per second: 278.87 [#/sec] (mean)
--------------------------------------------------------------------------------
Document Path: /_3rd_party/minify/web/ab_tests/minify/test_Version1.php?files=before.js
Document Length: 15993 bytes
(Connect: 2, Length: 0, Exceptions: 0)
Requests per second: 259.63 [#/sec] (mean)
--------------------------------------------------------------------------------
Document Path: /_3rd_party/minify/web/ab_tests/mod_deflate/before.js
Document Length: 16053 bytes
Requests per second: 191.62 [#/sec] (mean)
--------------------------------------------------------------------------------
Document Path: /_3rd_party/minify/web/ab_tests/type-map/before.js.var
Document Length: 15993 bytes
(Connect: 2, Length: 0, Exceptions: 0)
Requests per second: 503.94 [#/sec] (mean)
--------------------------------------------------------------------------------

View File

@ -1,5 +1,8 @@
@SET PATH=%PATH%;C:\xampp\apache\bin
@SET ABCALL=ab -d -S -c 100 -n 2000 -H "Accept-Encoding: deflate, gzip" http://localhost
@REM 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" http://mc.dev/_3rd_party
@SET DELIM=TYPE _delimiter
DEL results.txt

View File

@ -1,10 +1,12 @@
<?php
// ab test of Minify 1.0, mostly to see how fast it can serve server-cached files.
require '../../config.php';
define('MINIFY_BASE_DIR', realpath(
dirname(__FILE__) . '/../minify'
));
define('MINIFY_CACHE_DIR', 'C:/xampp/tmp');
define('MINIFY_CACHE_DIR', $minifyCachePath);
/**
* Minify - Combines, minifies, and caches JavaScript and CSS files on demand.

View File

@ -13,5 +13,5 @@ ini_set('include_path',
* Set $minifyCachePath to a PHP-writeable path to enable server-side caching
* in all examples and tests.
*/
$minifyCachePath = ''; // 'C:\\xampp\\tmp';
$minifyCachePath = 'C:/xampp/tmp'; // '';

View File

@ -60,7 +60,7 @@ function test_Minify()
'Cache-Control' => 'public, max-age=86400',
'Expires' => gmdate('D, d M Y H:i:s \G\M\T', $tomorrow),
'Content-Length' => strlen($content),
'Content-Type' => 'application/x-javascript',
'Content-Type' => 'application/x-javascript; charset=UTF-8',
)
);
$output = Minify::serve('Files', array(
@ -98,7 +98,7 @@ function test_Minify()
'ETag' => "\"{$lastModified}pub\"",
'Cache-Control' => 'max-age=0, public, must-revalidate',
'Content-Length' => filesize($minifyTestPath . '/minified.css'),
'Content-Type' => 'text/css',
'Content-Type' => 'text/css; charset=UTF-8',
)
);
$output = Minify::serve('Files', array(