File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ import path from 'node:path';
33import { getArguments } from './args.js' ;
44import { cyan , printBenchmarkResults , red } from './output.js' ;
55import { prepareBenchmarkProjects } from './projects.js' ;
6- import { collectSamples , sampleModule } from './sampling.js' ;
6+ import { collectSamples } from './sampling.js' ;
77import { computeStats } from './statistics.js' ;
88import type { BenchmarkProject , BenchmarkResult } from './types.js' ;
9+ import { getBenchmarkName } from './workers.js' ;
910
1011export function runBenchmarks ( ) : void {
1112 // Get the revisions and make things happen!
@@ -28,8 +29,7 @@ function runBenchmark(
2829 const modulePath = path . join ( projectPath , benchmark ) ;
2930
3031 if ( i === 0 ) {
31- const { name } = sampleModule ( modulePath ) ;
32- console . log ( '\u23F1 ' + name ) ;
32+ console . log ( '\u23F1 ' + getBenchmarkName ( modulePath ) ) ;
3333 }
3434
3535 try {
Original file line number Diff line number Diff line change @@ -5,8 +5,6 @@ import { yellow } from './output.js';
55import type { BenchmarkSample } from './types.js' ;
66import { sampleModule } from './workers.js' ;
77
8- export { sampleModule } ;
9-
108export function collectSamples ( modulePath : string ) : Array < BenchmarkSample > {
119 let numOfConsequentlyRejectedSamples = 0 ;
1210 const samples : Array < BenchmarkSample > = [ ] ;
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ export interface BenchmarkProject {
44}
55
66export interface BenchmarkSample {
7- name : string ;
87 clocked : number ;
98 memUsed : number ;
109 involuntaryContextSwitches : number ;
Original file line number Diff line number Diff line change 1+ import {
2+ loadBenchmark ,
3+ readModulePath ,
4+ runWorker ,
5+ writeResult ,
6+ } from './worker-utils.js' ;
7+
8+ runWorker ( async ( ) => {
9+ const benchmark = await loadBenchmark ( readModulePath ( ) ) ;
10+ writeResult ( benchmark . name ) ;
11+ } ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ runWorker(async () => {
2121 const resourcesEnd = process . resourceUsage ( ) ;
2222
2323 writeResult ( {
24- name : benchmark . name ,
2524 clocked : timeDiff / benchmark . count ,
2625 memUsed : ( process . memoryUsage ( ) . heapUsed - memBaseline ) / benchmark . count ,
2726 involuntaryContextSwitches :
Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ import { localRepoPath } from '../utils.js';
66import { nodeFlags } from './config.js' ;
77import type { BenchmarkSample } from './types.js' ;
88
9+ export function getBenchmarkName ( modulePath : string ) : string {
10+ return runWorkerFile (
11+ localRepoPath ( 'resources/benchmark/worker-name.js' ) ,
12+ modulePath ,
13+ ) as string ;
14+ }
15+
916export function sampleModule ( modulePath : string ) : BenchmarkSample {
1017 return runWorkerFile (
1118 localRepoPath ( 'resources/benchmark/worker-timing.js' ) ,
You can’t perform that action at this time.
0 commit comments