@@ -59,7 +59,8 @@ const STOP_AFTER = Number.isFinite(Number(process.env.STOP_AFTER ?? ''))
5959 */
6060function createPerformanceSession (
6161 programName ?: string ,
62- methodsSummary ?: Record < string , ConstraintSystemSummary >
62+ methodsSummary ?: Record < string , ConstraintSystemSummary > ,
63+ log = true
6364) {
6465 const perfStack : PerfStack [ ] = [ ] ;
6566 let endCounter = 0 ;
@@ -92,7 +93,7 @@ function createPerformanceSession(
9293
9394 /**
9495 * End the most recent measurement and:
95- * - Log results to console
96+ * - Optionally log results to console
9697 * - Dump into baseline JSON (if `--dump`)
9798 * - Check against baseline (if `--check`)
9899 */
@@ -103,13 +104,17 @@ function createPerformanceSession(
103104
104105 const time = ( performance . now ( ) - start ) / 1000 ;
105106
106- // Base logging — show contract.method for prove
107- if ( label )
107+ // Base logging — only if log is enabled
108+ // — shows contract.method for prove
109+ if ( log && label ) {
108110 console . log (
109- `${ label } ${ programName ?? '' } ${ label === 'prove' && methodName ? '.' + methodName : '' } ... ${ time . toFixed ( 3 ) } sec`
111+ `${ label } ${ programName ?? '' } ${
112+ label === 'prove' && methodName ? '.' + methodName : ''
113+ } ... ${ time . toFixed ( 3 ) } sec`
110114 ) ;
115+ }
111116
112- // If neither --dump nor --check, just log and honor STOP_AFTER
117+ // If neither --dump nor --check, just optionally log and honor STOP_AFTER
113118 if ( ! DUMP && ! CHECK ) {
114119 maybeStop ( ) ;
115120 return ;
@@ -140,7 +145,7 @@ function createPerformanceSession(
140145 return ;
141146 }
142147
143- // DUMP: update only contract-level compileTime (does not touch methods)
148+ // DUMP: update only contract-level compileTime
144149 if ( DUMP ) {
145150 const prev = perfRegressionJson [ programName ] ;
146151 const merged : PerfRegressionEntry = prev
@@ -236,9 +241,16 @@ const Performance = {
236241 * timestamps for arbitrary phases.
237242 * @param methodsSummary Optional analysis of ZkProgram methods, required when
238243 * measuring prove performance.
244+ * @param log Optional boolean flag (default: `true`).
245+ * When set to `false`, disables all console output for both general labels
246+ * and compile/prove phase logs.
239247 */
240- create ( programName ?: string , methodsSummary ?: Record < string , ConstraintSystemSummary > ) {
241- return createPerformanceSession ( programName , methodsSummary ) ;
248+ create (
249+ programName ?: string ,
250+ methodsSummary ?: Record < string , ConstraintSystemSummary > ,
251+ log ?: boolean
252+ ) {
253+ return createPerformanceSession ( programName , methodsSummary , log ) ;
242254 } ,
243255} ;
244256
0 commit comments