[changelog]
Update 13/12/2024 Update table and Historical link relate
Abstract
TODO explain in-short/summary.
Motivation
TODO explains the motivation problem of factor performance metric.
Specification
Transaction Per Second (TPS)
Measuring the performance of the EVM
based blockchain with Transactions Per Second (TPS
), is a smart contract transaction may do many operation sequences, so there are a lot of factors or elements that can influence the number of transactions per second, For example, consider smart contract transactions—performance can vary depending on the implementation used, whether it is optimized, or if it was compiled via Yul/IR."
Gas Per Second (GPS)
Measuring performance with Gas Per Second (GPS
) is more insightful than the TPS
, as it provides a more objective measure of computational resource usage.
However, GPS
also has its limitations. Each transaction can consume a varying amount of gas based on the opcodes used—some transactions may involve gas-intensive operations (e.g., storage I/O), while others may not. It’s still can be debatable when you take a closer look at the gasUsed
number alongside the number of transactions that packed inside each block
Opcode Per Second (OpPS)
TODO explain the concept of OpPS
tricky code for creating gas-intensive but low-workload
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Squeeze
* @dev Contract to demonstrate functions that are gas-intensive but perform minimal meaningful work.
*/
contract Squeeze {
/**
* @dev Performs repeated memory store operations.
* @param n The number of iterations to execute.
*/
function squeezeMem(uint n) external {
assembly {
let i := 0
for { } lt(i, n) { } {
i := add(i, 1)
mstore(0x20, n) // Store 'n' in memory repeatedly.
}
}
}
/**
* @dev Performs arithmetic operations with exponential calculations to increase gas usage.
* @param n The number of iterations to execute.
*/
function squeezeArith(uint n) external {
assembly {
let i := 0
for { } lt(i, n) { } {
i := add(i, 1)
// Perform a gas-intensive operation: exponentiation.
mstore(0x20, exp(mload(0x20), 0xff))
}
}
}
}
Opcode Category
[TODO] determine which opcode is I/O intensive workload
Arithmetic Operation add
,sub
,mod
,div
and other.
Bitwise Operation and
,or
,xor
,shl
,shr
,not
and other.
Comparator Operation lt
,gt
,eq
,slt
,sgt
, and iszero
Memory Operation mload
and mstore
Storage Operation sload
and sstore
Environment block.number
and other.
Stack JUMP
,SWAP
,PUSH
,DUP
and other.
Custom opcode may be found on Layer 2 network (L2) and modified version of EVM
Combine each metric TPS, GPS, and OpPS
TPS | GPS | OpPS | Description |
---|---|---|---|
High | Low | High | Many transactions with high opcode count but low gas consumption, using cheap opcodes. |
Low | High | High | Few transactions executing many cheap opcodes, leading to higher gas usage. |
High | High | Low | Many transactions using fewer but gas-intensive opcodes like sstore or call . |
Low | Low | High | Few transactions with high opcode count but minimal gas consumption, efficient operations. |
High | Low | Low | Many transactions using very few opcodes, resulting in low gas usage. |
Low | Low | Low | Few transactions with minimal opcode usage and low gas consumption, often trivial or idle. |
High | High | High | Many transactions with high gas usage and high opcode counts, indicating intensive workload. |
Low | High | Low | Few transactions consuming high gas but executing a small number of expensive opcodes. |
Rationale
missing another factor OpPS to exit the debate even the smart contract optimized or non-optimize
Backwards Compatibility
No backward compatibility issues found.
Security Considerations
[TODO]
Using one of each factor TPS, GPS, and OpPS alone might create bias in performance analysis
Historical link relate to this
Ethereum Yellow Paper link
EVM performance boosts with MLIR link
** EVM-Perf: High-Precision EVM Performance Analysis link
Reth’s path to 1 gigagas per second, and beyond link
Opbench: A CPU Performance Benchmark for Ethereum Smart Contract OPCODE link
evm-bench link
** you MAY require an IEEE Xplore account or request full-text form author.