-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
115 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export interface BenchmarkResult { | ||
size: number; | ||
wavelet: string; | ||
wasmlets: { | ||
timings: { | ||
wavedec: number; | ||
waverec: number; | ||
}; | ||
}; | ||
pywavelets: { | ||
timings: { | ||
wavedec: number; | ||
waverec: number; | ||
}; | ||
}; | ||
pywaveletsWithMarshalling: { | ||
timings: { | ||
wavedec: number; | ||
waverec: number; | ||
}; | ||
}; | ||
discreteWavelets: { | ||
timings: { | ||
wavedec: number; | ||
waverec?: number; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as fs from "fs/promises"; | ||
import * as path from "path"; | ||
import os from "os"; | ||
import { runBenchmarks } from "./benchmark.js"; | ||
|
||
async function main() { | ||
const systemInfo = { | ||
hostname: os.hostname(), | ||
os: process.platform, | ||
arch: process.arch, | ||
nodeVersion: process.version | ||
} | ||
const results = await runBenchmarks({ | ||
systemInfo | ||
}); | ||
|
||
// Save results | ||
const resultsJson = JSON.stringify(results, null, 2); | ||
console.log("\nResults:"); | ||
console.log(resultsJson); | ||
|
||
// Save results | ||
const outputDir = "output"; | ||
await fs.mkdir(outputDir, { recursive: true }); | ||
const mainOutputPath = path.join(outputDir, "benchmark.json"); | ||
await fs.writeFile(mainOutputPath, resultsJson); | ||
console.log(`\nResults saved to ${mainOutputPath}`); | ||
|
||
// If running in GitHub Actions, save archived copy | ||
if (process.env.GITHUB_ACTIONS) { | ||
const archiveDir = path.join("benchmark-results", "archive"); | ||
await fs.mkdir(archiveDir, { recursive: true }); | ||
const timestamp = new Date().toISOString().replace(/[:.]/g, "-"); | ||
const archivePath = path.join(archiveDir, `benchmark-${timestamp}.json`); | ||
await fs.writeFile(archivePath, resultsJson); | ||
console.log(`Archived copy saved to ${archivePath}`); | ||
} | ||
} | ||
|
||
// Run benchmarks | ||
main().catch(console.error); |