项目
在 GitHub 查看
kadenzipfel/gas-optimizations
关于
Solidity 智能合约优化清单
学习与教育实测星标增长
- 24小时
- 0
- 7天
- +1
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Gas Optimizations in Solidity
Gas Costly Patterns
- Comparison with Unilateral Outcome in a Loop
- Constant Outcome of a Loop
- Dead Code
- Expensive Operations in a Loop
- Loop Fusion
- Opaque Predicate
- Repeated Computations in a Loop
- Storage Variable as Loop Length
- Unnecessary Libraries
Gas Saving Patterns
- Proper Data Types
- Explicit Function Visibility
- Short Circuiting
- Constants and Immutables
- Struct Bit Packing
Gas Golfing
- Short Revert Strings
- Unchecked Arithmetic
- Optimal Comparison Operator
- Payable Functions
- Function Ordering
- Using Mulmod Over Mul & Div
- Optimal Increment and Decrement Operators
Sources/References
- https://medium.com/coinmonks/optimizing-your-solidity-contracts-gas-usage-9d65334db6c7
- https://ethereum.stackexchange.com/questions/28813/how-to-write-an-optimized-gas-cost-smart-contract
- https://arxiv.org/pdf/1703.03994.pdf
- https://ethereum.stackexchange.com/questions/3067/why-does-uint8-cost-more-gas-than-uint256
- https://www.youtube.com/watch?v=qwBkeJ84d2g&feature=youtu.be&t=68
- https://ethereum.stackexchange.com/questions/11556/use-string-type-or-bytes32
- https://gist.github.com/hrkrshnn/ee8fabd532058307229d65dcd5836ddc
- https://github.com/ZeroEkkusu/re-golf-course
探索相关项目
加载中…