2 # Copyright (C) 2004 Brion Vibber <brion@pobox.com> 3 # http://www.mediawiki.org/ 5 # This program is free software; you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation; either version 2 of the License, or 8 # (at your option) any later version. 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 15 # You should have received a copy of the GNU General Public License along 16 # with this program; if not, write to the Free Software Foundation, Inc., 17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 # http://www.gnu.org/copyleft/gpl.html 29 dl(
'php_utfnormal.so');
32 require_once
'include/Unicode/UtfNormal.php';
34 define(
'BENCH_CYCLES', 5);
36 if (php_sapi_name() !=
'cli') {
37 die(
"Run me from the command line please.\n");
41 'testdata/washington.txt' =>
'English text',
42 'testdata/berlin.txt' =>
'German text',
43 'testdata/bulgakov.txt' =>
'Russian text',
44 'testdata/tokyo.txt' =>
'Japanese text',
45 'testdata/young.txt' =>
'Korean text' 57 print
"Testing $filename ($desc)...\n";
68 array(
'fastDecompose',
'fastCombiningSort',
'fastCompose' ),
69 #
'quickIsNFC',
'quickIsNFCVerify',
71 foreach ($forms as
$form) {
72 if (is_array($form)) {
74 foreach ($form as $step) {
85 $st = explode(
' ', microtime());
86 return (
float) $st[0] + (float) $st[1];
92 #$start = benchTime(); 95 $out = $u->$form(
$data, $utfCanonicalDecomp);
98 #$delta = (benchTime() - $start) / BENCH_CYCLES; 100 $delta = $deltas[0]; # Take shortest
time 102 $rate = intval(strlen(
$data) / $delta);
106 " %20s %6.1fms %12s bytes/s (%s)\n",
109 number_format($rate),
110 ($same ?
'no change' :
'changed')
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
global $utfCanonicalDecomp
foreach($testfiles as $file=> $desc) benchmarkTest(&$u, $filename, $desc)
benchmarkForm(&$u, &$data, $form)
static loadData()
Load the basic composition data if necessary.
if(isset($_POST['submit'])) $form
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
if(php_sapi_name() !='cli') $testfiles