Skip to content

Commit

Permalink
feat: add tree metrics to github comment
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Jan 8, 2024
1 parent d1370a7 commit c10be24
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
8 changes: 6 additions & 2 deletions yarn-project/scripts/src/benchmarks/aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 5 additions & 1 deletion yarn-project/scripts/src/benchmarks/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)`;
Expand All @@ -202,7 +203,7 @@ ${getWarningsSummary(benchmark, baseBenchmark)}
<summary>Detailed results</summary>
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}
Expand All @@ -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.
Expand Down
14 changes: 10 additions & 4 deletions yarn-project/types/src/stats/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type MetricGroupBy =
| 'chain-length'
| 'circuit-name'
| 'contract-count'
| 'tree-name'
| 'leaf-count'
| 'private-writes'
| 'public-writes';

Expand Down Expand Up @@ -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[];
Expand Down

0 comments on commit c10be24

Please sign in to comment.