mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add optimizor club benchmark.
This commit is contained in:
parent
5e74e95b67
commit
0cf7236729
@ -344,7 +344,7 @@ library NFTSVG {
|
|||||||
'<g font-family="\'Courier New\', monospace" font-size="12" fill="#fff">'
|
'<g font-family="\'Courier New\', monospace" font-size="12" fill="#fff">'
|
||||||
'<g style="transform:translate(29px, 384px)">' '<rect width="',
|
'<g style="transform:translate(29px, 384px)">' '<rect width="',
|
||||||
LibString.toString(uint256(7 * (str1length + 4))),
|
LibString.toString(uint256(7 * (str1length + 4))),
|
||||||
'" height="26" rx="8" ry="8" fill="rgba(0,0,0,0.6)"/>' '<text x="12" y="17"><tspan fill="#999">ID: </tspan>',
|
string.concat('" height="26" rx="8" ry="8" fill="rgba(0,0,0,0.6)"/>' '<text x="12" y="17"><tspan fill="#999">ID: </tspan>'),
|
||||||
tokenId,
|
tokenId,
|
||||||
"</text></g>" '<g style="transform:translate(29px, 414px)">' '<rect width="',
|
"</text></g>" '<g style="transform:translate(29px, 414px)">' '<rect width="',
|
||||||
LibString.toString(uint256(7 * (str2length + 4))),
|
LibString.toString(uint256(7 * (str2length + 4))),
|
||||||
|
@ -26,12 +26,13 @@ set -euo pipefail
|
|||||||
REPO_ROOT=$(cd "$(dirname "$0")/../../" && pwd)
|
REPO_ROOT=$(cd "$(dirname "$0")/../../" && pwd)
|
||||||
SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build}
|
SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build}
|
||||||
|
|
||||||
result_legacy_file=$(mktemp -t benchmark-legacy-XXXXXX.txt)
|
output_dir=$(mktemp -d -t solc-benchmark-XXXXXX)
|
||||||
result_via_ir_file=$(mktemp -t benchmark-via-ir-XXXXXX.txt)
|
result_legacy_file="${output_dir}/benchmark-legacy.txt"
|
||||||
|
result_via_ir_file="${output_dir}/benchmark-via-ir.txt"
|
||||||
|
warnings_and_errors_file="${output_dir}/benchmark-warn-err.txt"
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
rm "${result_legacy_file}"
|
rm -r "${output_dir}"
|
||||||
rm "${result_via_ir_file}"
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,17 +40,19 @@ trap cleanup SIGINT SIGTERM
|
|||||||
|
|
||||||
solc="${SOLIDITY_BUILD_DIR}/solc/solc"
|
solc="${SOLIDITY_BUILD_DIR}/solc/solc"
|
||||||
benchmarks_dir="${REPO_ROOT}/test/benchmarks"
|
benchmarks_dir="${REPO_ROOT}/test/benchmarks"
|
||||||
|
benchmarks=("chains.sol" "OptimizorClub.sol")
|
||||||
time_bin_path=$(type -P time)
|
time_bin_path=$(type -P time)
|
||||||
|
|
||||||
for input_file in "chains.sol" "OptimizorClub.sol"
|
for input_file in "${benchmarks[@]}"
|
||||||
do
|
do
|
||||||
input_path="${benchmarks_dir}/${input_file}"
|
input_path="${benchmarks_dir}/${input_file}"
|
||||||
|
|
||||||
solc_command_legacy=("${solc}" --optimize --bin "${input_path}")
|
solc_command_legacy=("${solc}" --optimize --bin --color "${input_path}")
|
||||||
solc_command_via_ir=("${solc}" --via-ir --optimize --bin "${input_path}")
|
solc_command_via_ir=("${solc}" --via-ir --optimize --bin --color "${input_path}")
|
||||||
|
|
||||||
"${time_bin_path}" --output "${result_legacy_file}" --format "%e" "${solc_command_legacy[@]}" >/dev/null
|
# Legacy can fail.
|
||||||
"${time_bin_path}" --output "${result_via_ir_file}" --format "%e" "${solc_command_via_ir[@]}" >/dev/null
|
"${time_bin_path}" --output "${result_legacy_file}" --format "%e" "${solc_command_legacy[@]}" >/dev/null 2>>"${warnings_and_errors_file}"
|
||||||
|
"${time_bin_path}" --output "${result_via_ir_file}" --format "%e" "${solc_command_via_ir[@]}" >/dev/null 2>>"${warnings_and_errors_file}"
|
||||||
|
|
||||||
time_legacy=$(<"${result_legacy_file}")
|
time_legacy=$(<"${result_legacy_file}")
|
||||||
time_via_ir=$(<"${result_via_ir_file}")
|
time_via_ir=$(<"${result_via_ir_file}")
|
||||||
@ -62,5 +65,11 @@ do
|
|||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "======================================================="
|
||||||
|
echo "Warnings and errors generated during run:"
|
||||||
|
echo "======================================================="
|
||||||
|
echo "$(<"${warnings_and_errors_file}")"
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user