Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions scripts/cape-subcommands/submission/index.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,19 @@

{{if gt .submission_count 0}}
<div class="winners">
{{if .winners.total_fee}}
<div class="winner-item">
<div class="winner-label"><span class="medal">💰</span> Lowest Fee</div>
<div class="winner-value">{{.winners.total_fee.formatted}} lovelace</div>
{{range $idx, $sub := .winners.total_fee.submissions}}{{if lt $idx 3}}
<div class="winner-submission">{{$sub.compiler}}_{{$sub.version}}_{{$sub.author}}{{if ne $sub.variant "default"}}_{{$sub.variant}}{{end}}</div>
{{end}}{{end}}
{{if gt .winners.total_fee.total 3}}
<div class="winner-more">(+{{sub .winners.total_fee.total 3}} more)</div>
{{end}}
</div>
{{end}}

{{if .winners.cpu}}
<div class="winner-item">
<div class="winner-label"><span class="medal">🥇</span> Best CPU</div>
Expand Down Expand Up @@ -334,6 +347,19 @@

{{if gt .submission_count 0}}
<div class="winners">
{{if .winners.total_fee}}
<div class="winner-item">
<div class="winner-label"><span class="medal">💰</span> Lowest Fee</div>
<div class="winner-value">{{.winners.total_fee.formatted}} lovelace</div>
{{range $idx, $sub := .winners.total_fee.submissions}}{{if lt $idx 3}}
<div class="winner-submission">{{$sub.compiler}}_{{$sub.version}}_{{$sub.author}}{{if ne $sub.variant "default"}}_{{$sub.variant}}{{end}}</div>
{{end}}{{end}}
{{if gt .winners.total_fee.total 3}}
<div class="winner-more">(+{{sub .winners.total_fee.total 3}} more)</div>
{{end}}
</div>
{{end}}

{{if .winners.cpu}}
<div class="winner-item">
<div class="winner-label"><span class="medal">🥇</span> Best CPU</div>
Expand Down
9 changes: 6 additions & 3 deletions scripts/cape-subcommands/submission/report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,9 @@ 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). The total
# fee (execution fee plus reference-script fee) leads: it is what a transaction
# pays, and it weighs CPU, memory and size the way the ledger does.
find_winners() {
local benchmark_csv="$1"

Expand Down Expand Up @@ -680,13 +682,14 @@ find_winners() {
echo -n "]}"
}

local cpu_json memory_json script_json term_json
local fee_json cpu_json memory_json script_json term_json
fee_json=$(build_winners_json "${CSV_COL[total_fee_lovelace]}" "total_fee")
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,\"cpu\":$cpu_json,\"memory\":$memory_json,\"script_size\":$script_json,\"term_size\":$term_json}"
}

generate_index_report() {
Expand Down
Loading