@@ -95,10 +95,13 @@ function getCell(
95
95
row : string ,
96
96
col : string ,
97
97
) {
98
- const value = data [ row ] [ col ] ;
98
+ const value : number | undefined = data [ row ] [ col ] ;
99
99
const formattedValue = formatValue ( value ) ;
100
- const baseValue = base ? ( base [ row ] ?? { } ) [ col ] : undefined ;
101
- const percentDiff = baseValue ? Math . round ( ( ( value - baseValue ) / baseValue ) * 100 ) : undefined ;
100
+ const baseValue : number | undefined = base ?. [ row ] ?. [ col ] ;
101
+ const percentDiff =
102
+ typeof baseValue === 'number' && baseValue > 0 && typeof value === 'number'
103
+ ? Math . round ( ( ( value - baseValue ) / baseValue ) * 100 )
104
+ : undefined ;
102
105
if ( ! percentDiff || Math . abs ( percentDiff ) < 1 ) {
103
106
return formattedValue ;
104
107
}
@@ -118,7 +121,11 @@ function withDesc(name: string) {
118
121
}
119
122
120
123
/** Formats a numeric value for display. */
121
- function formatValue ( value : number ) {
124
+ function formatValue ( value : number | undefined ) : string {
125
+ if ( typeof value === 'undefined' ) {
126
+ return 'N/A' ;
127
+ }
128
+
122
129
if ( value < 100 ) {
123
130
return value . toPrecision ( 3 ) ;
124
131
}
@@ -180,6 +187,10 @@ export function getMarkdown() {
180
187
const metricsByChainLength = Metrics . filter ( m => m . groupBy === 'chain-length' ) . map ( m => m . name ) ;
181
188
const metricsByCircuitName = Metrics . filter ( m => m . groupBy === 'circuit-name' ) . map ( m => m . name ) ;
182
189
const metricsByContractCount = Metrics . filter ( m => m . groupBy === 'contract-count' ) . map ( m => m . name ) ;
190
+ const metricsByLeafCount = Metrics . filter ( m => m . groupBy === 'leaf-count' ) . map ( m => m . name ) ;
191
+
192
+ const metricsTxPxeProcessing = Metrics . filter ( m => m . name === 'tx_pxe_processing_time_ms' ) . map ( m => m . name ) ;
193
+ const metricsTxSeqProcessing = Metrics . filter ( m => m . name === 'tx_sequencer_processing_time_ms' ) . map ( m => m . name ) ;
183
194
184
195
const baseHash = process . env . BASE_COMMIT_HASH ;
185
196
const baseUrl = baseHash && `[\`${ baseHash . slice ( 0 , 8 ) } \`](${ S3_URL } /benchmarks-v1/master/${ baseHash } .json)` ;
@@ -202,7 +213,7 @@ ${getWarningsSummary(benchmark, baseBenchmark)}
202
213
203
214
<summary>Detailed results</summary>
204
215
205
- All benchmarks are run on txs on the \`Benchmarking\` contract on the repository. Each tx consists of a batch call to \`create_note\` and \`increment_balance\`, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.
216
+ All benchmarks are run on txs on the \`Benchmarking\` contract on the repository. Each tx consists of a batch call to \`create_note\` and \`increment_balance\`, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.
206
217
${ prSourceDataText }
207
218
${ baseCommitText }
208
219
@@ -221,11 +232,20 @@ ${getTableContent(pick(benchmark, metricsByChainLength), baseBenchmark, 'blocks'
221
232
Stats on running time and I/O sizes collected for every circuit run across all benchmarks.
222
233
${ getTableContent ( transpose ( pick ( benchmark , metricsByCircuitName ) ) , transpose ( baseBenchmark ) , '' , 'Circuit' ) }
223
234
235
+ ### Tree insertion stats
236
+
237
+ The duration to insert a fixed batch of leaves into each tree type.
238
+ ${ getTableContent ( pick ( benchmark , metricsByLeafCount ) , baseBenchmark , 'leaves' ) }
239
+
224
240
### Miscellaneous
225
241
226
242
Transaction sizes based on how many contracts are deployed in the tx.
227
243
${ getTableContent ( pick ( benchmark , metricsByContractCount ) , baseBenchmark , 'deployed contracts' ) }
228
244
245
+ Transaction processing duration by data writes.
246
+ ${ getTableContent ( pick ( benchmark , metricsTxPxeProcessing ) , baseBenchmark , 'new commitments' ) }
247
+ ${ getTableContent ( pick ( benchmark , metricsTxSeqProcessing ) , baseBenchmark , 'public data writes' ) }
248
+
229
249
</details>
230
250
${ COMMENT_MARK }
231
251
` ;
0 commit comments