From 48cf55eae47636ddd17ed8d87dd52d3cc0e4e178 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sun, 23 Jul 2006 18:18:11 +0000 Subject: [PATCH] Switch benchmark to relative percents: makes comparisons easier. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@101 48356398-32a2-884e-a903-53898d9a118a --- benchmarks/Lexer.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/benchmarks/Lexer.php b/benchmarks/Lexer.php index fdd01863..5fe3a55b 100644 --- a/benchmarks/Lexer.php +++ b/benchmarks/Lexer.php @@ -41,16 +41,22 @@ class RowTimer extends Benchmark_Timer $out .= "{$this->name}"; + $standard = false; + foreach ($result as $k => $v) { if ($v['name'] == 'Start' || $v['name'] == 'Stop') continue; //$perc = (($v['diff'] * 100) / $total); //$tperc = (($v['total'] * 100) / $total); - $out .= '' . $v['diff'] . ''; + //$out .= '' . $v['diff'] . ''; - //$out .= '' . number_format($perc, 2, '.', '') . - // '%'; + if ($standard == false) $standard = $v['diff']; + + $perc = $v['diff'] * 100 / $standard; + + $out .= '' . number_format($perc, 2, '.', '') . + '%'; }