diff --git a/scripts/cape-subcommands/submission/index.html.tmpl b/scripts/cape-subcommands/submission/index.html.tmpl index 9423383d..f29e8987 100644 --- a/scripts/cape-subcommands/submission/index.html.tmpl +++ b/scripts/cape-subcommands/submission/index.html.tmpl @@ -112,6 +112,23 @@ padding: 12px 15px; border-radius: 4px; } + .winner-item.headline { + border-left-color: #28a745; + background: #eef9f1; + } + .metric-legend { + max-width: 900px; + margin: 20px auto 0; + padding: 12px 18px; + background: rgba(255, 255, 255, 0.9); + border-radius: 8px; + color: #333; + font-size: 0.9em; + text-align: left; + } + .metric-legend p { + margin: 4px 0; + } .winner-label { font-size: 0.85em; color: #6c757d; @@ -223,6 +240,12 @@ +
+

💰 Lowest Fee: what one execution costs on Cardano mainnet. It is the execution fee for CPU and memory plus the reference-script fee for the script size, at the ledger's prices.

+

📦 Most per Transaction: how many executions of the most expensive measured case fit in one transaction's budget. No fee raises this limit.

+

The CPU, memory and size medals show the raw measurements behind both.

+
+
@@ -253,6 +276,39 @@ {{if gt .submission_count 0}}
+ {{if .winners.total_fee}} +
+
💰 Lowest Fee
+
{{.winners.total_fee.formatted}} lovelace
+ {{range $idx, $sub := .winners.total_fee.submissions}}{{if lt $idx 3}} +
{{$sub.compiler}}_{{$sub.version}}_{{$sub.author}}{{if ne $sub.variant "default"}}_{{$sub.variant}}{{end}}
+ {{end}}{{end}} + {{if gt .winners.total_fee.total 3}} +
(+{{sub .winners.total_fee.total 3}} more)
+ {{end}} +
+ {{end}} + + {{if .winners.scripts_per_tx}} +
+
📦 Most per Transaction
+ {{if gt .winners.scripts_per_tx.value 0}} +
{{.winners.scripts_per_tx.formatted}} scripts
+ {{range $idx, $sub := .winners.scripts_per_tx.submissions}}{{if lt $idx 3}} +
{{$sub.compiler}}_{{$sub.version}}_{{$sub.author}}{{if ne $sub.variant "default"}}_{{$sub.variant}}{{end}}
+ {{end}}{{end}} + {{if gt .winners.scripts_per_tx.total 3}} +
(+{{sub .winners.scripts_per_tx.total 3}} more)
+ {{end}} + {{else}} +
None fit
+
The most expensive case exceeds one transaction's budget for every submission.
+ {{end}} +
+ {{end}} +
+
+ {{if .winners.cpu}}
🥇 Best CPU
@@ -334,6 +390,39 @@ {{if gt .submission_count 0}}
+ {{if .winners.total_fee}} +
+
💰 Lowest Fee
+
{{.winners.total_fee.formatted}} lovelace
+ {{range $idx, $sub := .winners.total_fee.submissions}}{{if lt $idx 3}} +
{{$sub.compiler}}_{{$sub.version}}_{{$sub.author}}{{if ne $sub.variant "default"}}_{{$sub.variant}}{{end}}
+ {{end}}{{end}} + {{if gt .winners.total_fee.total 3}} +
(+{{sub .winners.total_fee.total 3}} more)
+ {{end}} +
+ {{end}} + + {{if .winners.scripts_per_tx}} +
+
📦 Most per Transaction
+ {{if gt .winners.scripts_per_tx.value 0}} +
{{.winners.scripts_per_tx.formatted}} scripts
+ {{range $idx, $sub := .winners.scripts_per_tx.submissions}}{{if lt $idx 3}} +
{{$sub.compiler}}_{{$sub.version}}_{{$sub.author}}{{if ne $sub.variant "default"}}_{{$sub.variant}}{{end}}
+ {{end}}{{end}} + {{if gt .winners.scripts_per_tx.total 3}} +
(+{{sub .winners.scripts_per_tx.total 3}} more)
+ {{end}} + {{else}} +
None fit
+
The most expensive case exceeds one transaction's budget for every submission.
+ {{end}} +
+ {{end}} +
+
+ {{if .winners.cpu}}
🥇 Best CPU
diff --git a/scripts/cape-subcommands/submission/report.sh b/scripts/cape-subcommands/submission/report.sh index e0696fec..1a798906 100755 --- a/scripts/cape-subcommands/submission/report.sh +++ b/scripts/cape-subcommands/submission/report.sh @@ -635,16 +635,24 @@ categorize_scenario() { echo "$category" } -# Returns JSON with winners for each of the four headline metrics (handles ties). +# Returns JSON with winners for each headline metric (handles ties). Two lead: +# the total fee (execution fee plus reference-script fee), which is what one +# execution costs and weighs CPU, memory and size the way the ledger does; and +# scripts per transaction, the most worst-case executions that fit in one +# transaction's budget, a limit no fee can raise. find_winners() { local benchmark_csv="$1" build_winners_json() { local metric_col="$1" local metric_name="$2" + # "min" for costs, "max" for capacity (more scripts per transaction is better). + local best="${3:-min}" + local sort_flags="-n" + [ "$best" = "max" ] && sort_flags="-rn" local best_value - best_value=$(echo "$benchmark_csv" | awk -F, -v col="$metric_col" '{print $col}' | sort -n | head -1) + best_value=$(echo "$benchmark_csv" | awk -F, -v col="$metric_col" '{print $col}' | sort $sort_flags | head -1) if [ -z "$best_value" ]; then echo "null" @@ -680,13 +688,15 @@ find_winners() { echo -n "]}" } - local cpu_json memory_json script_json term_json + local fee_json per_tx_json cpu_json memory_json script_json term_json + fee_json=$(build_winners_json "${CSV_COL[total_fee_lovelace]}" "total_fee") + per_tx_json=$(build_winners_json "${CSV_COL[scripts_per_tx]}" "scripts_per_tx" max) cpu_json=$(build_winners_json "${CSV_COL[cpu_units]}" "cpu") memory_json=$(build_winners_json "${CSV_COL[memory_units]}" "memory") script_json=$(build_winners_json "${CSV_COL[script_size_bytes]}" "script_size") term_json=$(build_winners_json "${CSV_COL[term_size]}" "term_size") - echo "{\"cpu\":$cpu_json,\"memory\":$memory_json,\"script_size\":$script_json,\"term_size\":$term_json}" + echo "{\"total_fee\":$fee_json,\"scripts_per_tx\":$per_tx_json,\"cpu\":$cpu_json,\"memory\":$memory_json,\"script_size\":$script_json,\"term_size\":$term_json}" } generate_index_report() {