Skip to content

Commit

Permalink
fix: segment tree insertion stats by depth (AztecProtocol#4029)
Browse files Browse the repository at this point in the history
Extract more accurate data for tree insertion duration by segmenting
metrics by their tree depth
  • Loading branch information
alexghr authored Jan 16, 2024
1 parent 6121ec5 commit 2787bae
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
16 changes: 14 additions & 2 deletions yarn-project/circuit-types/src/stats/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,25 @@ export const Metrics = [
events: ['tx-sequencer-processing'],
},
{
name: 'batch_insert_into_append_only_tree_ms',
name: 'batch_insert_into_append_only_tree_16_depth_ms',
groupBy: 'leaf-count',
description: 'Time to insert a batch of leaves into an append-only tree',
events: ['tree-insertion'],
},
{
name: 'batch_insert_into_indexed_tree_ms',
name: 'batch_insert_into_append_only_tree_32_depth_ms',
groupBy: 'leaf-count',
description: 'Time to insert a batch of leaves into an append-only tree',
events: ['tree-insertion'],
},
{
name: 'batch_insert_into_indexed_tree_20_depth_ms',
groupBy: 'leaf-count',
description: 'Time to insert a batch of leaves into an indexed tree',
events: ['tree-insertion'],
},
{
name: 'batch_insert_into_indexed_tree_40_depth_ms',
groupBy: 'leaf-count',
description: 'Time to insert a batch of leaves into an indexed tree',
events: ['tree-insertion'],
Expand Down
13 changes: 11 additions & 2 deletions yarn-project/scripts/src/benchmarks/aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,19 @@ function processTxSequencerProcessingStats(entry: TxSequencerProcessingStats, re
/** Process a tree insertion event and updates results */
function processTreeInsertion(entry: TreeInsertionStats, results: BenchmarkCollectedResults) {
const bucket = entry.batchSize;
const depth = entry.treeDepth;
if (entry.treeType === 'append-only') {
append(results, 'batch_insert_into_append_only_tree_ms', bucket, entry.duration);
if (depth === 16) {
append(results, 'batch_insert_into_append_only_tree_16_depth_ms', bucket, entry.duration);
} else if (depth === 32) {
append(results, 'batch_insert_into_append_only_tree_32_depth_ms', bucket, entry.duration);
}
} else if (entry.treeType === 'indexed') {
append(results, 'batch_insert_into_indexed_tree_ms', bucket, entry.duration);
if (depth === 20) {
append(results, 'batch_insert_into_indexed_tree_20_depth_ms', bucket, entry.duration);
} else if (depth === 40) {
append(results, 'batch_insert_into_indexed_tree_40_depth_ms', bucket, entry.duration);
}
}
}

Expand Down

0 comments on commit 2787bae

Please sign in to comment.