MediaWiki master
benchmarkGlobalVarConfig.php
Go to the documentation of this file.
1<?php
2
5
6require_once __DIR__ . '/../includes/Benchmarker.php';
7
14 public function __construct() {
15 parent::__construct();
16 $this->addDescription( 'Benchmark GlobalVarConfig::get()' );
17 }
18
19 public function execute() {
20 $config = new GlobalVarConfig();
21 $GLOBALS['wgBenchmarkGlobalVarConfigTest'] = 'value';
22 $GLOBALS['wgBenchmarkGlobalVarConfigTestNull'] = null;
23
24 $benches = [
25 'GlobalVarConfig::get (hit)' => [
26 'function' => static function () use ( $config ) {
27 $config->get( 'BenchmarkGlobalVarConfigTest' );
28 }
29 ],
30 'GlobalVarConfig::get (null)' => [
31 'function' => static function () use ( $config ) {
32 $config->get( 'BenchmarkGlobalVarConfigTestNull' );
33 }
34 ],
35 ];
36
37 $this->bench( $benches );
38 }
39}
40
41$maintClass = BenchmarkGlobalVarConfig::class;
42require_once RUN_MAINTENANCE_IF_MAIN;
Benchmark GlobalVarConfig::get()
Accesses configuration settings from $GLOBALS.
Base class for benchmark scripts.
addDescription( $text)
Set the description text.