name = htmlentities($name); $this->Benchmark_Timer($auto); } function getOutput() { $total = $this->TimeElapsed(); $result = $this->getProfiling(); $dashes = ''; $out = ''; $out .= "{$this->name}"; 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 .= '' . number_format($perc, 2, '.', '') . // "%"; } $out .= ''; return $out; } } ?> Benchmark: DirectLex versus PEAR's XML_HTMLSax3

Benchmark: DirectLex versus PEAR's XML_HTMLSax3

start(); $lexer = new HTMLPurifier_Lexer_DirectLex(); $tokens = $lexer->tokenizeHTML($document); $timer->setMarker('HTMLPurifier_Lexer'); $lexer = new HTMLPurifier_Lexer_PEARSax3(); $sax_tokens = $lexer->tokenizeHTML($document); $timer->setMarker('HTMLPurifier_Lexer_Sax'); $timer->stop(); $timer->display(); } // sample of html pages $dir = 'samples/Lexer'; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { if (strpos($filename, '.html') !== strlen($filename) - 5) continue; $document = file_get_contents($dir . '/' . $filename); do_benchmark("File: $filename", $document); } // crashers $snippets = array(); $snippets[] = ''; foreach ($snippets as $snippet) { do_benchmark($snippet, $snippet); } // random input $random = Text_Password::create(80, 'unpronounceable', 'qwerty <>="\''); do_benchmark('Random input', $random); ?>
CaseDirectLexXML_HTMLSax3
Random input was: ' . '' . htmlentities($random) . ''; ?>