Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions JetStreamDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2391,9 +2391,10 @@ function processTestList(testList)
else
benchmarkNames = testList.split(/[\s,]/);

for (const name of benchmarkNames) {
for (let name of benchmarkNames) {
name = name.toLowerCase();
if (benchmarksByTag.has(name))
benchmarks.push(...findBenchmarksByTag(name));
benchmarks.concat(findBenchmarksByTag(name));
else
benchmarks.push(findBenchmarkByName(name));
}
Expand Down
25 changes: 23 additions & 2 deletions generators/async-file-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ class File {
set data(dataView) { this._data = dataView; }

swapByteOrder() {
let hash = 0x1a2b3c4d;
for (let i = 0; i < Math.floor(this.data.byteLength / 8) * 8; i += 8) {
this.data.setFloat64(i, this.data.getFloat64(i, isLittleEndian), !isLittleEndian);
const data = this.data.getFloat64(i, isLittleEndian);
this.data.setFloat64(i, data, !isLittleEndian);
hash ^= data | 0;
}
return hash;
}
}

Expand Down Expand Up @@ -171,11 +175,16 @@ async function setupDirectory() {
}

class Benchmark {
EXPECTED_FILE_COUNT = 666;

totalFileCount = 0;
lastFileHash = undefined;

async runIteration() {
const fs = await setupDirectory();

for await (let { entry: file } of fs.forEachFileRecursively()) {
file.swapByteOrder();
this.lastFileHash = file.swapByteOrder();
}

for await (let { name, entry: dir } of fs.forEachDirectoryRecursively()) {
Expand All @@ -187,5 +196,17 @@ class Benchmark {
}
}
}

for await (let _ of fs.forEachFileRecursively()) {
this.totalFileCount++;
}
}

validate(iterations) {
const expectedFileCount = this.EXPECTED_FILE_COUNT * iterations;
if (this.totalFileCount != expectedFileCount)
throw new Error(`Invalid total file count ${this.totalFileCount}, expected ${expectedFileCount}.`);
if (this.lastFileHash === undefined)
throw new Error(`Invalid file hash: ${this.lastFileHash}`);
}
}
25 changes: 23 additions & 2 deletions generators/sync-file-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ class File {
set data(dataView) { this._data = dataView; }

swapByteOrder() {
let hash = 0x1a2b3c4d;
for (let i = 0; i < Math.floor(this.data.byteLength / 8) * 8; i += 8) {
this.data.setFloat64(i, this.data.getFloat64(i, isLittleEndian), !isLittleEndian);
const data = this.data.getFloat64(i, isLittleEndian);
this.data.setFloat64(i, data, !isLittleEndian);
hash ^= data | 0;
}
return hash;
}
}

Expand Down Expand Up @@ -161,11 +165,16 @@ function setupDirectory() {
}

class Benchmark {
EXPECTED_FILE_COUNT = 411;

totalFileCount = 0;
lastFileHash = undefined;

runIteration() {
const fs = setupDirectory();

for (let { entry: file } of fs.forEachFileRecursively()) {
file.swapByteOrder();
this.lastFileHash = file.swapByteOrder();
}

for (let { name, entry: dir } of fs.forEachDirectoryRecursively()) {
Expand All @@ -178,5 +187,17 @@ class Benchmark {
}
}
}

for (let _ of fs.forEachFileRecursively()) {
this.totalFileCount++;
}
}

validate(iterations) {
const expectedFileCount = this.EXPECTED_FILE_COUNT * iterations;
if (this.totalFileCount != expectedFileCount)
throw new Error(`Invalid total file count ${this.totalFileCount}, expected ${expectedFileCount}.`);
if (this.lastFileHash === undefined)
throw new Error(`Invalid file hash: ${this.lastFileHash}`);
}
}
4 changes: 2 additions & 2 deletions tests/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async function testEnd2End(params) {

async function benchmarkResults(driver) {
logInfo("JetStream START");
await driver.manage().setTimeouts({ script: 60_000 });
await driver.manage().setTimeouts({ script: 2 * 60_000 });
await driver.executeAsyncScript((callback) => {
globalThis.JetStream.start();
callback();
Expand All @@ -118,7 +118,7 @@ async function benchmarkResults(driver) {

class JetStreamTestError extends Error {
constructor(errors) {
super(`Tests failed: ${errors.map(e => e.name).join(", ")}`);
super(`Tests failed: ${errors.map(e => e.stack).join(", ")}`);
this.errors = errors;
}

Expand Down
Loading