-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
30 lines (29 loc) · 1021 Bytes
/
makefile
File metadata and controls
30 lines (29 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.PHONY: benchmark
benchmark:
@forge test --mc Benchmark > test_output.txt
@echo "| Test | YUL | Inline Assembly | SOLADY | SOLMATE |" > benchmark.md
@echo "|------|-----|-----------------|--------|---------|" >> benchmark.md
@gawk '/\[PASS\]/ { \
match($$2, /test_(.+)_(.+)\(\)/, arr); \
test = arr[1]; \
type = arr[2]; \
gsub(/\(|\)/, "", $$NF); \
gas = $$NF; \
if (type == "inlineAssembly") inlineAssembly[test] = gas; \
else if (type == "yul") yul[test] = gas; \
else if (type == "solady") solady[test] = gas; \
else if (type == "solmate") solmate[test] = gas; \
tests[test] = 1; \
} \
END { \
for (test in tests) { \
printf "| %s | %s | %s | %s | %s |\n", \
test, \
(yul[test] ? yul[test] : "-"), \
(inlineAssembly[test] ? inlineAssembly[test] : "-"), \
(solady[test] ? solady[test] : "-"), \
(solmate[test] ? solmate[test] : "-"); \
} \
}' test_output.txt | sort >> benchmark.md
@rm test_output.txt
@echo "Benchmark results have been written to benchmark.md"