From c10be24a81151eca85e9d2a91e0abc5a6d7bbc8b Mon Sep 17 00:00:00 2001 From: Alex Gherghisan Date: Mon, 8 Jan 2024 10:52:04 +0000 Subject: [PATCH] feat: add tree metrics to github comment --- yarn-project/scripts/src/benchmarks/aggregate.ts | 8 ++++++-- yarn-project/scripts/src/benchmarks/markdown.ts | 6 +++++- yarn-project/types/src/stats/metrics.ts | 14 ++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/yarn-project/scripts/src/benchmarks/aggregate.ts b/yarn-project/scripts/src/benchmarks/aggregate.ts index 36cb1303212..bb0dbb21fe1 100644 --- a/yarn-project/scripts/src/benchmarks/aggregate.ts +++ b/yarn-project/scripts/src/benchmarks/aggregate.ts @@ -166,8 +166,12 @@ function processTxSequencerProcessingStats(entry: TxSequencerProcessingStats, re /** Process a tree insertion event and updates results */ function processTreeInsertion(entry: TreeInsertionStats, results: BenchmarkCollectedResults) { - const bucket = entry.treeName + '_batch_' + entry.batchSize + '_leaves'; - append(results, 'tree_insertion_time_in_ms', bucket, entry.duration); + const bucket = entry.batchSize; + if (entry.treeType === 'append-only') { + append(results, 'batch_insert_into_append_only_tree_ms', bucket, entry.duration); + } else if (entry.treeType === 'indexed') { + append(results, 'batch_insert_into_indexed_tree_ms', bucket, entry.duration); + } } /** Processes a parsed entry from a log-file and updates results */ diff --git a/yarn-project/scripts/src/benchmarks/markdown.ts b/yarn-project/scripts/src/benchmarks/markdown.ts index 7b8b843fb36..fa4c340dffe 100644 --- a/yarn-project/scripts/src/benchmarks/markdown.ts +++ b/yarn-project/scripts/src/benchmarks/markdown.ts @@ -180,6 +180,7 @@ export function getMarkdown() { const metricsByChainLength = Metrics.filter(m => m.groupBy === 'chain-length').map(m => m.name); const metricsByCircuitName = Metrics.filter(m => m.groupBy === 'circuit-name').map(m => m.name); const metricsByContractCount = Metrics.filter(m => m.groupBy === 'contract-count').map(m => m.name); + const metricsByLeafCount = Metrics.filter(m => m.groupBy === 'leaf-count').map(m => m.name); const baseHash = process.env.BASE_COMMIT_HASH; const baseUrl = baseHash && `[\`${baseHash.slice(0, 8)}\`](${S3_URL}/benchmarks-v1/master/${baseHash}.json)`; @@ -202,7 +203,7 @@ ${getWarningsSummary(benchmark, baseBenchmark)} Detailed results -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. +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. ${prSourceDataText} ${baseCommitText} @@ -221,6 +222,9 @@ ${getTableContent(pick(benchmark, metricsByChainLength), baseBenchmark, 'blocks' Stats on running time and I/O sizes collected for every circuit run across all benchmarks. ${getTableContent(transpose(pick(benchmark, metricsByCircuitName)), transpose(baseBenchmark), '', 'Circuit')} +Tree insertion stats +${getTableContent(pick(benchmark, metricsByLeafCount), baseBenchmark, 'leaves')} + ### Miscellaneous Transaction sizes based on how many contracts are deployed in the tx. diff --git a/yarn-project/types/src/stats/metrics.ts b/yarn-project/types/src/stats/metrics.ts index b5b8bd4948e..a66d31be3a1 100644 --- a/yarn-project/types/src/stats/metrics.ts +++ b/yarn-project/types/src/stats/metrics.ts @@ -6,7 +6,7 @@ export type MetricGroupBy = | 'chain-length' | 'circuit-name' | 'contract-count' - | 'tree-name' + | 'leaf-count' | 'private-writes' | 'public-writes'; @@ -147,9 +147,15 @@ export const Metrics = [ events: ['tx-sequencer-processing'], }, { - name: 'tree_insertion_time_in_ms', - groupBy: 'tree-name', - description: 'Time to insert a batch of leaves into a tree', + name: 'batch_insert_into_append_only_tree_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', + groupBy: 'leaf-count', + description: 'Time to insert a batch of leaves into an indexed tree', events: ['tree-insertion'], }, ] as const satisfies readonly Metric[];