*
* @ingroup Benchmark
*/
-class bench_HTTP_HTTPS extends Benchmarker {
-
+class BenchHttpHttps extends Benchmarker {
public function __construct() {
parent::__construct();
$this->mDescription = "Benchmark HTTP request vs HTTPS request.";
$this->bench( array(
array( 'function' => array( $this, 'getHTTP' ) ),
array( 'function' => array( $this, 'getHTTPS' ) ),
- ));
+ ) );
print $this->getFormattedResults();
}
}
}
-$maintClass = 'bench_HTTP_HTTPS';
+$maintClass = 'BenchHttpHttps';
require_once RUN_MAINTENANCE_IF_MAIN;
* @ingroup Benchmark
*/
class BenchmarkDeleteTruncate extends Benchmarker {
-
public function __construct() {
parent::__construct();
$this->mDescription = "Benchmarks SQL DELETE vs SQL TRUNCATE.";
*
* @ingroup Maintenance
*/
-class bench_if_switch extends Benchmarker {
-
+class BenchIfSwitch extends Benchmarker {
public function __construct() {
parent::__construct();
$this->mDescription = "Benchmark if elseif... versus switch case.";
$this->bench( array(
array( 'function' => array( $this, 'doElseIf' ) ),
array( 'function' => array( $this, 'doSwitch' ) ),
- ));
+ ) );
print $this->getFormattedResults();
}
// bench function 1
function doElseIf() {
$a = 'z';
- if( $a == 'a') {}
- elseif( $a == 'b') {}
- elseif( $a == 'c') {}
- elseif( $a == 'd') {}
- elseif( $a == 'e') {}
- elseif( $a == 'f') {}
- elseif( $a == 'g') {}
- elseif( $a == 'h') {}
- elseif( $a == 'i') {}
- elseif( $a == 'j') {}
- elseif( $a == 'k') {}
- elseif( $a == 'l') {}
- elseif( $a == 'm') {}
- elseif( $a == 'n') {}
- elseif( $a == 'o') {}
- elseif( $a == 'p') {}
- else {}
+ if ( $a == 'a' ) {
+ } elseif ( $a == 'b' ) {
+ } elseif ( $a == 'c' ) {
+ } elseif ( $a == 'd' ) {
+ } elseif ( $a == 'e' ) {
+ } elseif ( $a == 'f' ) {
+ } elseif ( $a == 'g' ) {
+ } elseif ( $a == 'h' ) {
+ } elseif ( $a == 'i' ) {
+ } elseif ( $a == 'j' ) {
+ } elseif ( $a == 'k' ) {
+ } elseif ( $a == 'l' ) {
+ } elseif ( $a == 'm' ) {
+ } elseif ( $a == 'n' ) {
+ } elseif ( $a == 'o' ) {
+ } elseif ( $a == 'p' ) {
+ } else {
+ }
}
// bench function 2
function doSwitch() {
$a = 'z';
- switch( $a ) {
- case 'b': break;
- case 'c': break;
- case 'd': break;
- case 'e': break;
- case 'f': break;
- case 'g': break;
- case 'h': break;
- case 'i': break;
- case 'j': break;
- case 'k': break;
- case 'l': break;
- case 'm': break;
- case 'n': break;
- case 'o': break;
- case 'p': break;
+ switch ( $a ) {
+ case 'b':
+ break;
+ case 'c':
+ break;
+ case 'd':
+ break;
+ case 'e':
+ break;
+ case 'f':
+ break;
+ case 'g':
+ break;
+ case 'h':
+ break;
+ case 'i':
+ break;
+ case 'j':
+ break;
+ case 'k':
+ break;
+ case 'l':
+ break;
+ case 'm':
+ break;
+ case 'n':
+ break;
+ case 'o':
+ break;
+ case 'p':
+ break;
default:
}
}
}
-$maintClass = 'bench_if_switch';
+$maintClass = 'BenchIfSwitch';
require_once RUN_MAINTENANCE_IF_MAIN;
*
* @ingroup Benchmark
*/
-class bench_strtr_str_replace extends Benchmarker {
-
+class BenchStrtrStrReplace extends Benchmarker {
public function __construct() {
parent::__construct();
$this->mDescription = "Benchmark for strtr() vs str_replace().";
function benchstr_replace_indirect() {
bfNormalizeTitleStrReplace( "[[MediaWiki:Some_random_test_page]]" );
}
-
}
-$maintClass = 'bench_strtr_str_replace';
+$maintClass = 'BenchStrtrStrReplace';
require_once RUN_MAINTENANCE_IF_MAIN;
*
* @ingroup Benchmark
*/
-class bench_utf8_title_check extends Benchmarker {
-
+class BenchUtf8TitleCheck extends Benchmarker {
private $canRun;
private $data;
public function __construct() {
parent::__construct();
+ // @codingStandardsIgnoreStart Ignore long line warnings.
$this->data = array(
"",
"United States of America", // 7bit ASCII
. "Sara%20Sidle%7CSofia%20Curtis%7CS%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e%7CWallace%20Langham%7C"
. "Warrick%20Brown%7CWendy%20Simms%7C%C3%89tats-Unis"
);
+ // @codingStandardsIgnoreEnd
$this->canRun = function_exists ( 'mb_check_encoding' );
if ( $this->canRun ) {
- $this->mDescription = "Benchmark for using a regexp vs. mb_check_encoding to check for UTF-8 encoding.";
+ $this->mDescription = "Benchmark for using a regexp vs. mb_check_encoding " .
+ "to check for UTF-8 encoding.";
mb_internal_encoding( 'UTF-8' );
} else {
$this->mDescription = "CANNOT RUN benchmark using mb_check_encoding: function not available.";
function use_mb_check_encoding( $s ) {
$this->isutf8 = mb_check_encoding( $s, 'UTF-8' );
}
-
}
-$maintClass = 'bench_utf8_title_check';
+$maintClass = 'BenchUtf8TitleCheck';
require_once RUN_MAINTENANCE_IF_MAIN;
*
* @ingroup Benchmark
*/
-class bench_wfBaseConvert extends Benchmarker {
-
+class BenchWfBaseConvert extends Benchmarker {
public function __construct() {
parent::__construct();
$this->mDescription = "Benchmark for wfBaseConvert.";
}
}
-$maintClass = 'bench_wfBaseConvert';
+$maintClass = 'BenchWfBaseConvert';
require_once RUN_MAINTENANCE_IF_MAIN;
*
* @ingroup Benchmark
*/
-class bench_wfIsWindows extends Benchmarker {
-
+class BenchWfIsWindows extends Benchmarker {
public function __construct() {
parent::__construct();
$this->mDescription = "Benchmark for wfIsWindows.";
}
}
-$maintClass = 'bench_wfIsWindows';
+$maintClass = 'BenchWfIsWindows';
require_once RUN_MAINTENANCE_IF_MAIN;
* @ingroup Benchmark
*/
class BenchmarkHooks extends Benchmarker {
-
public function __construct() {
parent::__construct();
$this->mDescription = 'Benchmark MediaWiki Hooks.';
* @ingroup Benchmark
*/
class BenchmarkPurge extends Benchmarker {
-
public function __construct() {
parent::__construct();
$this->mDescription = "Benchmark the Squid purge functions.";