Simple benchmarks across different Solidity parser implementations.
Requires cloning submodules: git submodule update --init --recursive
.
Run with:
# Criterion
cargo criterion -p solar-bench --bench bench -- --quiet --format terse | & tee benches/tables.in
./benches/tables.py ./benches/README.md < benches/tables.in
# iai - requires `valgrind` and `iai-callgrind-runner`
cargo bench -p solar-bench --bench iai
This crate is excluded from the main workspace to avoid compiling it (and its dependencies) when
invoking other commands such as cargo test
.
The following results were achieved on:
Target: x86_64-unknown-linux-gnu
CPU: AMD Ryzen 9 7950X;
Versions:
solc 0.8.28
solar @ 30b73e9
solang-parser =0.3.4
slang =0.18.2
Parser
Relative
Time
LoC/s
Bytes/s
solang
1.00x
12.088 ns
N/A
N/A
solar
45.33x
544.81 ns
N/A
N/A
Parser
Relative
Time
LoC/s
Bytes/s
solang
1.00x
101.31 ns
N/A
N/A
solar
8.38x
846.95 ns
N/A
N/A
solc
9.90x
1.0000 µs
N/A
N/A
slang
37.23x
3.7603 µs
N/A
N/A
Counter (14 LoC, 258 bytes)
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
1.4252 µs
9.82M
181.05M
solang
1.11x
1.5804 µs
8.86M
163.29M
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
3.3853 µs
4.14M
76.22M
solang
2.72x
9.2166 µs
1.52M
27.99M
solc
16.57x
56.100 µs
249.55K
4.60M
slang
53.68x
181.72 µs
77.04K
1.42M
verifier (208 LoC, 11040 bytes)
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
37.936 µs
5.48M
291.02M
solang
1.87x
70.801 µs
2.94M
155.93M
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
92.462 µs
2.25M
119.40M
solang
5.11x
472.12 µs
440.57K
23.38M
solc
6.89x
637.20 µs
326.43K
17.33M
slang
108.43x
10.026 ms
20.75K
1.10M
OptimizorClub (782 LoC, 35905 bytes)
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
126.59 µs
6.18M
283.63M
solang
1.54x
194.45 µs
4.02M
184.65M
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
256.01 µs
3.05M
140.25M
solang
5.18x
1.3255 ms
589.97K
27.09M
solc
6.09x
1.5592 ms
501.54K
23.03M
slang
106.58x
27.286 ms
28.66K
1.32M
UniswapV3 (3189 LoC, 146583 bytes)
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
361.62 µs
8.82M
405.35M
solang
1.85x
670.52 µs
4.76M
218.61M
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
720.27 µs
4.43M
203.51M
solang
4.78x
3.4409 ms
926.79K
42.60M
solc
6.39x
4.6060 ms
692.36K
31.82M
slang
102.48x
73.813 ms
43.20K
1.99M
Solarray (1544 LoC, 35898 bytes)
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
216.19 µs
7.14M
166.05M
solang
1.47x
317.62 µs
4.86M
113.02M
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
551.84 µs
2.80M
65.05M
solc
3.99x
2.2019 ms
701.21K
16.30M
solang
5.18x
2.8561 ms
540.60K
12.57M
slang
124.22x
68.552 ms
22.52K
523.66K
console (1552 LoC, 67315 bytes)
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
305.93 µs
5.07M
220.03M
solang
1.57x
481.54 µs
3.22M
139.79M
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
644.21 µs
2.41M
104.49M
solc
5.22x
3.3653 ms
461.18K
20.00M
solang
5.62x
3.6188 ms
428.87K
18.60M
slang
115.71x
74.539 ms
20.82K
903.08K
Vm (1763 LoC, 91405 bytes)
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
203.56 µs
8.66M
449.03M
solang
2.12x
431.17 µs
4.09M
211.99M
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
338.37 µs
5.21M
270.13M
solang
4.18x
1.4136 ms
1.25M
64.66M
solc
7.32x
2.4762 ms
711.98K
36.91M
slang
57.94x
19.605 ms
89.93K
4.66M
safeconsole (13248 LoC, 397898 bytes)
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
1.6472 ms
8.04M
241.56M
solang
1.54x
2.5411 ms
5.21M
156.58M
Parser
Relative
Time
LoC/s
Bytes/s
solar
1.00x
4.7190 ms
2.81M
84.32M
solang
4.08x
19.263 ms
687.74K
20.66M
solc
4.42x
20.869 ms
634.81K
19.07M
slang
90.86x
428.78 ms
30.90K
927.98K