Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5991183
benchmarkJsValidate.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
benchmarkJsValidate.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
* @ingroup Benchmark
*/
use
MediaWiki\Maintenance\Benchmarker
;
// @codeCoverageIgnoreStart
require_once
__DIR__
.
'/../includes/Benchmarker.php'
;
// @codeCoverageIgnoreEnd
/**
* Measure ResourceLoader syntax validation for user-supplied JavaScript.
*
* @see ResourceLoader\Module::validateScriptFile
* @see JSParseHelper
* @ingroup Benchmark
*/
class
BenchmarkJsValidate
extends
Benchmarker
{
/** @inheritDoc */
protected
$defaultCount
=
10
;
public
function
__construct
()
{
parent
::
__construct
();
$this
->
addDescription
(
'Measure JavaScript syntax validation.'
);
$this
->
addOption
(
'file'
,
'Path to JS file. Default: jquery'
,
false
,
true
);
}
public
function
execute
()
{
$file
=
$this
->
getOption
(
'file'
,
__DIR__
.
'/data/jsmin/jquery-3.2.1.js.gz'
);
$content
=
$this
->
loadFile
(
$file
);
if
(
$content
===
false
)
{
$this
->
fatalError
(
'Unable to open input file'
);
}
$filename
=
basename
(
$file
);
$this
->
bench
(
[
"Peast::parse ($filename)"
=>
[
'function'
=>
static
function
(
$content
)
{
Peast\Peast
::
ES2017
(
$content
)->
parse
();
},
'args'
=>
[
$content
]
]
]
);
}
}
// @codeCoverageIgnoreStart
$maintClass
=
BenchmarkJsValidate
::
class
;
require_once
RUN_MAINTENANCE_IF_MAIN
;
// @codeCoverageIgnoreEnd
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Oct 4, 01:47 (4 w, 6 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
41/47/b7defa199dae004e6b76a17f756a
Default Alt Text
benchmarkJsValidate.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment