File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
3
class CSSJanusBenchmark {
4
+ private $ fixtures ;
5
+
6
+ /**
7
+ * @param null|array<string,string> $fixtures Map from label to input CSS
8
+ */
9
+ public function __construct (array $ fixtures = null ) {
10
+ $ this ->fixtures = $ fixtures ?? self ::getFixtures ();
11
+ }
4
12
5
13
public function run () {
6
- foreach (self :: getFixtures () as $ name => $ data ) {
14
+ foreach ($ this -> fixtures as $ name => $ data ) {
7
15
$ iterations = 10_000 ;
8
16
$ total = 0 ;
9
17
$ max = -INF ;
Original file line number Diff line number Diff line change 3
3
require_once __DIR__ . '/../vendor/autoload.php ' ;
4
4
require_once __DIR__ . '/CSSJanusBenchmark.php ' ;
5
5
6
- ( new CSSJanusBenchmark )->run ();
6
+ $ fixtures = null ;
7
+ if (isset ($ argv [1 ])) {
8
+ $ name = basename ($ argv [1 ]);
9
+ $ data = file_get_contents ($ argv [1 ]);
10
+ $ fixtures = [ $ name => $ data ];
11
+ }
12
+
13
+ ( new CSSJanusBenchmark ($ fixtures ) )->run ();
You can’t perform that action at this time.
0 commit comments