1
1
/*
2
- * Copyright (C) 2025 Apple Inc. All rights reserved.
3
- *
4
- * Redistribution and use in source and binary forms, with or without
5
- * modification, are permitted provided that the following conditions
6
- * are met:
7
- * 1. Redistributions of source code must retain the above copyright
8
- * notice, this list of conditions and the following disclaimer.
9
- * 2. Redistributions in binary form must reproduce the above copyright
10
- * notice, this list of conditions and the following disclaimer in the
11
- * documentation and/or other materials provided with the distribution.
12
- *
13
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
- */
2
+ * Copyright (C) 2025 Apple Inc. All rights reserved.
3
+ *
4
+ * Redistribution and use in source and binary forms, with or without
5
+ * modification, are permitted provided that the following conditions
6
+ * are met:
7
+ * 1. Redistributions of source code must retain the above copyright
8
+ * notice, this list of conditions and the following disclaimer.
9
+ * 2. Redistributions in binary form must reproduce the above copyright
10
+ * notice, this list of conditions and the following disclaimer in the
11
+ * documentation and/or other materials provided with the distribution.
12
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
+ */
25
25
26
26
const EXPECTED_ASSERTION_COUNT = 1213680 ;
27
27
28
28
class Benchmark extends StartupBenchmark {
29
29
lastResult ;
30
30
totalHash = 0xdeadbeef ;
31
31
samples = [ ] ;
32
-
32
+
33
33
constructor ( iterationCount ) {
34
34
super ( {
35
35
iterationCount,
@@ -65,9 +65,9 @@ class Benchmark extends StartupBenchmark {
65
65
runIteration ( iteration ) {
66
66
// Module is loaded into PrismJSBenchmark
67
67
let PrismJSBenchmark ;
68
- eval ( this . iterationSourceCodes [ iteration ] )
68
+ eval ( this . iterationSourceCodes [ iteration ] ) ;
69
69
this . lastResult = PrismJSBenchmark . runTest ( this . samples ) ;
70
-
70
+
71
71
for ( const result of this . lastResult ) {
72
72
result . hash = this . quickHash ( result . html ) ;
73
73
this . totalHash ^= result . hash ;
@@ -80,7 +80,10 @@ class Benchmark extends StartupBenchmark {
80
80
const sample = this . samples [ i ] ;
81
81
const result = this . lastResult [ i ] ;
82
82
console . assert ( result . html . length > 0 ) ;
83
- console . assert ( result . hash == sample . hash , `Invalid result.hash = ${ result . hash } , expected ${ sample . hash } ` ) ;
83
+ console . assert (
84
+ result . hash == sample . hash ,
85
+ `Invalid result.hash = ${ result . hash } , expected ${ sample . hash } `
86
+ ) ;
84
87
}
85
88
}
86
89
}
0 commit comments