mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 13:21:51 +00:00
Remove old profiling script, improve original two so they work, and are more efficient
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1456 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
4066416160
commit
85a23bacb6
@ -1,13 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// emulates inserting a dir called HTMLPurifier into your class dir
|
require_once '../library/HTMLPurifier.auto.php';
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . '../library/');
|
|
||||||
|
|
||||||
@include_once '../test-settings.php';
|
@include_once '../test-settings.php';
|
||||||
|
|
||||||
require_once 'HTMLPurifier/ConfigSchema.php';
|
// PEAR
|
||||||
require_once 'HTMLPurifier/Config.php';
|
require_once 'Benchmark/Timer.php'; // to do the timing
|
||||||
require_once 'HTMLPurifier/Context.php';
|
require_once 'Text/Password.php'; // for generating random input
|
||||||
|
|
||||||
$LEXERS = array();
|
$LEXERS = array();
|
||||||
$RUNS = isset($GLOBALS['HTMLPurifierTest']['Runs'])
|
$RUNS = isset($GLOBALS['HTMLPurifierTest']['Runs'])
|
||||||
@ -16,22 +14,11 @@ $RUNS = isset($GLOBALS['HTMLPurifierTest']['Runs'])
|
|||||||
require_once 'HTMLPurifier/Lexer/DirectLex.php';
|
require_once 'HTMLPurifier/Lexer/DirectLex.php';
|
||||||
$LEXERS['DirectLex'] = new HTMLPurifier_Lexer_DirectLex();
|
$LEXERS['DirectLex'] = new HTMLPurifier_Lexer_DirectLex();
|
||||||
|
|
||||||
if (!empty($GLOBALS['HTMLPurifierTest']['PEAR'])) {
|
|
||||||
require_once 'HTMLPurifier/Lexer/PEARSax3.php';
|
|
||||||
$LEXERS['PEARSax3'] = new HTMLPurifier_Lexer_PEARSax3();
|
|
||||||
} else {
|
|
||||||
exit('PEAR required to perform benchmark.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version_compare(PHP_VERSION, '5', '>=')) {
|
if (version_compare(PHP_VERSION, '5', '>=')) {
|
||||||
require_once 'HTMLPurifier/Lexer/DOMLex.php';
|
require_once 'HTMLPurifier/Lexer/DOMLex.php';
|
||||||
$LEXERS['DOMLex'] = new HTMLPurifier_Lexer_DOMLex();
|
$LEXERS['DOMLex'] = new HTMLPurifier_Lexer_DOMLex();
|
||||||
}
|
}
|
||||||
|
|
||||||
// PEAR
|
|
||||||
require_once 'Benchmark/Timer.php'; // to do the timing
|
|
||||||
require_once 'Text/Password.php'; // for generating random input
|
|
||||||
|
|
||||||
// custom class to aid unit testing
|
// custom class to aid unit testing
|
||||||
class RowTimer extends Benchmark_Timer
|
class RowTimer extends Benchmark_Timer
|
||||||
{
|
{
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . '../library/');
|
|
||||||
|
|
||||||
require_once 'HTMLPurifier/ConfigSchema.php';
|
|
||||||
require_once 'HTMLPurifier/Config.php';
|
|
||||||
require_once 'HTMLPurifier/Lexer/DirectLex.php';
|
|
||||||
require_once 'HTMLPurifier/Context.php';
|
|
||||||
|
|
||||||
$input = file_get_contents('samples/Lexer/4.html');
|
|
||||||
$lexer = new HTMLPurifier_Lexer_DirectLex();
|
|
||||||
$config = HTMLPurifier_Config::createDefault();
|
|
||||||
$context = new HTMLPurifier_Context();
|
|
||||||
|
|
||||||
for ($i = 0; $i < 10; $i++) {
|
|
||||||
$tokens = $lexer->tokenizeHTML($input, $config, $context);
|
|
||||||
}
|
|
@ -3,6 +3,11 @@
|
|||||||
ini_set('xdebug.trace_format', 1);
|
ini_set('xdebug.trace_format', 1);
|
||||||
ini_set('xdebug.show_mem_delta', true);
|
ini_set('xdebug.show_mem_delta', true);
|
||||||
|
|
||||||
|
if (file_exists('Trace.xt')) {
|
||||||
|
echo "Previous trace Trace.xt must be removed before this script can be run.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
xdebug_start_trace(dirname(__FILE__) . '/Trace');
|
xdebug_start_trace(dirname(__FILE__) . '/Trace');
|
||||||
require_once '../library/HTMLPurifier.auto.php';
|
require_once '../library/HTMLPurifier.auto.php';
|
||||||
|
|
||||||
@ -10,3 +15,5 @@ $purifier = new HTMLPurifier();
|
|||||||
|
|
||||||
$data = $purifier->purify(file_get_contents('samples/Lexer/4.html'));
|
$data = $purifier->purify(file_get_contents('samples/Lexer/4.html'));
|
||||||
xdebug_stop_trace();
|
xdebug_stop_trace();
|
||||||
|
|
||||||
|
echo "Trace finished.";
|
||||||
|
Loading…
Reference in New Issue
Block a user