本文是 Alloy 相对比于其他库的性能基准测试报告,Alloy 在 ABI 编码、Rlp 编码和解码、以及 U256 操作上通常比 Ethers 和 Parity-Rlp 快数倍。
Ethers |
Alloy |
|
---|---|---|
静态 |
1.12 us (✅ 1.00x) |
90.89 ns (🚀 12.32x faster) |
动态 |
2.20 us (✅ 1.00x) |
1.88 us (✅ 1.17x faster) |
EthAbi |
Alloy |
|
---|---|---|
Seaport |
35.43 us (✅ 1.00x) |
38.68 us (✅ 1.09x slower) |
PoolManager |
18.33 us (✅ 1.00x) |
17.94 us (✅ 1.02x faster) |
UniswapV3Pool |
14.61 us (✅ 1.00x) |
12.99 us (✅ 1.12x faster) |
EthAbi |
Alloy |
|
---|---|---|
Seaport |
209.43 us (✅ 1.00x) |
210.67 us (✅ 1.01x slower) |
PoolManager |
89.05 us (✅ 1.00x) |
93.31 us (✅ 1.05x slower) |
UniswapV3Pool |
63.24 us (✅ 1.00x) |
68.50 us (✅ 1.08x slower) |
EthAbi |
Alloy |
|
---|---|---|
序列化 |
5.03 us (✅ 1.00x) |
247.82 ns (🚀 20.29x faster) |
反序列化 |
14.10 us (✅ 1.00x) |
14.05 us (✅ 1.00x faster) |
Parity-Rlp |
Alloy-Rlp |
|
---|---|---|
编码 |
86.70 ns (✅ 1.00x) |
26.88 ns (🚀 3.23x faster) |
解码 |
88.79 ns (✅ 1.00x) |
21.43 ns (🚀 4.14x faster) |
Ethers |
Alloy |
|
---|---|---|
amountIn |
512.47 ns (✅ 1.00x) |
216.32 ns (🚀 2.37x faster) |
amountOut |
53.82 ns (✅ 1.00x) |
18.19 ns (🚀 2.96x faster) |
使用 criterion-table 生成
- 原文链接: github.com/alloy-rs/exam...
- 登链社区 AI 助手,为大家转译优秀英文文章,如有翻译不通的地方,还请包涵~
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!