MediaWiki REL1_33
benchmarkJavaScriptMinifier.php
Go to the documentation of this file.
1<?php
23require_once __DIR__ . '/Benchmarker.php';
24
31 protected $defaultCount = 10;
32
33 public function __construct() {
34 parent::__construct();
35 $this->addDescription( 'Benchmark for JavaScriptMinifier.' );
36 $this->addOption( 'file', 'Path to JavaScript file (may be gzipped)', false, true );
37 }
38
39 public function execute() {
40 $file = $this->getOption( 'file', __DIR__ . '/jsmin/jquery-3.2.1.js.gz' );
41 $filename = basename( $file );
42 $content = $this->loadFile( $file );
43 if ( $content === false ) {
44 $this->fatalError( 'Unable to open input file' );
45 }
46
47 $this->bench( [
48 "minify ($filename)" => [
49 'function' => [ JavaScriptMinifier::class, 'minify' ],
50 'args' => [ $content ],
51 ],
52 ] );
53 }
54}
55
56$maintClass = BenchmarkJavaScriptMinifier::class;
57require_once RUN_MAINTENANCE_IF_MAIN;
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Maintenance script that benchmarks JavaScriptMinifier.
Base class for benchmark scripts.
bench(array $benchs)
loadFile( $file)
addDescription( $text)
Set the description text.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
getOption( $name, $default=null)
Get an option, or return the default.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
require_once RUN_MAINTENANCE_IF_MAIN
$content