addDescription( 'Benchmarks JSMinPlus.' ); $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 ); $parser = new JSParser(); $this->bench( [ "JSParser::parse ($filename)" => [ 'function' => static function ( $parser, $content, $filename ) { $parser->parse( $content, $filename, 1 ); }, 'args' => [ $parser, $content, $filename ] ] ] ); } } $maintClass = BenchmarkJSMinPlus::class; require_once RUN_MAINTENANCE_IF_MAIN;