Skip to content

Commit 5a67a45

Browse files
committed
Merge branch 'main' into 2024-11-26_tags
2 parents a69f12e + f8d60ba commit 5a67a45

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

JetStream.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,16 @@ a.button {
296296

297297
}
298298

299-
.benchmark h3, .benchmark h4, .benchmark .result, .benchmark label {
299+
.benchmark h4, .benchmark .result, .benchmark label {
300300
color: transparent;
301301
background: linear-gradient(160deg, rgba(249,249,249,1) 0%, rgba(238,238,238,1) 100%);
302302
border-radius: 3px;
303303
}
304304

305+
.benchmark h3 {
306+
color: rgb(183, 183, 183);
307+
}
308+
305309
.benchmark-running h4, .benchmark-running .result, .benchmark-running label {
306310
color: #86D9FF;
307311
background-color: #86D9FF;

RexBench/Octane2/regexp.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,23 @@ function RegExpBenchmark() {
7272
if (array) {
7373
for (var i = 0; i < array.length; i++) {
7474
var substring = array[i];
75-
if (substring) sum += substring.length;
75+
if (substring) {
76+
sum += substring.length;
77+
sum += resultHash(substring)
78+
}
7679
}
7780
}
7881
return sum;
7982
}
83+
84+
function resultHash(substring) {
85+
let sum = 0;
86+
for (let j = 0; j < substring.length; j+=37)
87+
sum ^= substring.charCodeAt(j)
88+
sum ^= substring.charCodeAt(substring.length-1)
89+
return sum;
90+
}
91+
8092
var re0 = /^ba/;
8193
var re1 = /(((\w+):\/\/)([^\/:]*)(:(\d+))?)?([^#?]*)(\?([^#]*))?(#(.*))?/;
8294
var re2 = /^\s*|\s*$/g;

generators/async-file-system.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ function computeIsLittleEndian() {
3434
}
3535

3636
const isLittleEndian = computeIsLittleEndian();
37+
let globalCounter = 0;
3738

38-
function randomFileContents(bytes = ((Math.random() * 128) >>> 0) + 2056) {
39-
let result = new ArrayBuffer(bytes);
39+
function randomFileContents() {
40+
const numBytes = (globalCounter % 128) + 2056;
41+
globalCounter++;
42+
let result = new ArrayBuffer(numBytes);
4043
let view = new Uint8Array(result);
41-
for (let i = 0; i < bytes; ++i)
42-
view[i] = (Math.random() * 255) >>> 0;
44+
for (let i = 0; i < numBytes; ++i)
45+
view[i] = (i + globalCounter) % 255;
4346
return new DataView(result);
4447
}
4548

@@ -112,7 +115,7 @@ class Directory {
112115
} else {
113116
yield item;
114117
}
115-
}
118+
}
116119
}
117120

118121
async* forEachDirectoryRecursively() {
@@ -124,7 +127,7 @@ class Directory {
124127
yield dirItem;
125128

126129
yield item;
127-
}
130+
}
128131
}
129132

130133
async fileCount() {
@@ -145,19 +148,22 @@ class Directory {
145148
async function setupDirectory() {
146149
const fs = new Directory;
147150
let dirs = [fs];
151+
let counter = 0;
148152
for (let dir of dirs) {
149-
for (let i = 0; i < 8; ++i) {
150-
if (dirs.length < 250 && Math.random() >= 0.3) {
153+
for (let i = 0; i < 10; ++i) {
154+
if (dirs.length < 400 && (counter % 3) <= 1) {
151155
dirs.push(await dir.addDirectory(`dir-${i}`));
152156
}
157+
counter++;
153158
}
154159
}
155160

156161
for (let dir of dirs) {
157162
for (let i = 0; i < 5; ++i) {
158-
if (Math.random() >= 0.6) {
163+
if ((counter % 3) === 0) {
159164
await dir.addFile(`file-${i}`, new File(randomFileContents()));
160165
}
166+
counter++;
161167
}
162168
}
163169

@@ -178,7 +184,6 @@ class Benchmark {
178184
let result = await dir.rm(name);
179185
if (!result)
180186
throw new Error("rm should have returned true");
181-
182187
}
183188
}
184189
}

0 commit comments

Comments
 (0)