27require_once __DIR__ .
'/../includes/Benchmarker.php';
40 private $titleFormatter;
49 private $dbKey =
'FooBar';
65 parent::__construct();
66 $this->addDescription(
'Benchmark TitleValue vs Title.' );
70 $this->titleFormatter = $this->getServiceContainer()->getTitleFormatter();
71 $this->titleParser = $this->getServiceContainer()->getTitleParser();
74 $this->toParse =
'Category:FooBar';
77 'function' => [ $this,
'constructTitleValue' ],
80 'function' => [ $this,
'constructTitle' ],
83 'function' => [ $this,
'constructTitleSafe' ],
86 'function' => [ $this,
'getPrefixedTextTitleValue' ],
89 'function' => [ $this,
'getPrefixedTextTitle' ],
91 'parseTitleValue cached' => [
92 'function' => [ $this,
'parseTitleValue' ],
93 'setup' => [ $this,
'randomize' ],
95 'parseTitle cached' => [
96 'function' => [ $this,
'parseTitle' ],
97 'setup' => [ $this,
'randomize' ],
99 'parseTitleValue no cache' => [
100 'function' => [ $this,
'parseTitleValue' ],
101 'setupEach' => [ $this,
'randomize' ],
103 'parseTitle no cache' => [
104 'function' => [ $this,
'parseTitle' ],
105 'setupEach' => [ $this,
'randomize' ],
122 return Title::makeTitle(
NS_CATEGORY, $this->dbKey );
126 return Title::makeTitleSafe(
NS_CATEGORY, $this->dbKey );
131 return $this->titleFormatter->getPrefixedText( $this->titleValue );
135 return $this->title->getPrefixedText();
140 $this->titleParser->parseTitle(
'Category:' . $this->dbKey,
NS_MAIN );
144 Title::newFromText(
'Category:' . $this->dbKey );
150require_once RUN_MAINTENANCE_IF_MAIN;
wfRandomString( $length=32)
Get a random string containing a number of pseudo-random hex characters.
Maintenance script that benchmarks TitleValue vs Title.
getPrefixedTextTitleValue()
randomize()
Use a different dbKey each time to avoid influence of Title caches.