File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed
benchmark.js-plugin/benches Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change
1
+ import { logDebug } from "@codspeed/core" ;
1
2
import Benchmark from "benchmark" ;
2
3
import { withCodSpeed } from ".." ;
3
4
import parsePr from "./parsePr" ;
@@ -11,7 +12,7 @@ const LONG_BODY =
11
12
12
13
const suite = withCodSpeed ( new Benchmark . Suite ( ) ) ;
13
14
14
- console . log ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
15
+ logDebug ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
15
16
16
17
suite
17
18
. add ( "RegExp#test" , function ( ) {
Original file line number Diff line number Diff line change @@ -8,3 +8,12 @@ export function getGitDir(path: string): string | undefined {
8
8
} as FindupOptions ) ;
9
9
return dotGitPath ? dirname ( dotGitPath ) : undefined ;
10
10
}
11
+
12
+ /**
13
+ * Log debug messages if the environment variable `CODSPEED_DEBUG` is set.
14
+ */
15
+ export function logDebug ( ...args : unknown [ ] ) {
16
+ if ( process . env . CODSPEED_DEBUG ) {
17
+ console . log ( ...args ) ;
18
+ }
19
+ }
Original file line number Diff line number Diff line change
1
+ import { logDebug } from "@codspeed/core" ;
1
2
import { Bench } from "tinybench" ;
2
3
import { withCodSpeed } from ".." ;
3
4
import parsePr from "./parsePr" ;
@@ -11,7 +12,7 @@ const LONG_BODY =
11
12
12
13
const bench = withCodSpeed ( new Bench ( { time : 100 } ) ) ;
13
14
14
- console . log ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
15
+ logDebug ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
15
16
16
17
bench
17
18
. add ( "switch 1" , ( ) => {
Original file line number Diff line number Diff line change 1
1
import {
2
2
getGitDir ,
3
+ logDebug ,
3
4
Measurement ,
4
5
optimizeFunction ,
5
6
setupCore ,
@@ -66,7 +67,7 @@ function patchRootSuiteWithFullFilePath(suite: Suite) {
66
67
67
68
class CodSpeedRunner extends NodeBenchmarkRunner {
68
69
async runSuite ( suite : Suite ) : Promise < void > {
69
- logCodSpeed ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
70
+ logDebug ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
70
71
setupCore ( ) ;
71
72
72
73
patchRootSuiteWithFullFilePath ( suite ) ;
You can’t perform that action at this time.
0 commit comments