Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 2.16 KB

clones-benchmark.md

File metadata and controls

29 lines (20 loc) · 2.16 KB

Clones Benchmark

Worked on setting up a simple Clone contract that is used by the EIP1167 factory, which uses openzeppelin's clones library. This was compared with clones with immutable arguments which reduces gas drastically. Note the difference in the clone used by the immutable args factory here

The one disadvantage here is that etherscan still doesn't display a read/write UI for clones with immutable args. I hope this changes soon.

Gas savings turn out to be about ~31%.

Results

| src/patterns/EIP1167Factory.sol:EIP1167Factory contract |                 |       |        |       |         |
|---------------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost                                         | Deployment Size |       |        |       |         |
| 362135                                                  | 1928            |       |        |       |         |
| Function Name                                           | min             | avg   | median | max   | # calls |
| createClone                                             | 93084           | 93084 | 93084  | 93084 | 1       |


| src/patterns/immutable-args/ImmutableArgsCloneFactory.sol:ImmutableArgsCloneFactory contract |                 |       |        |       |         |
|----------------------------------------------------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost                                                                              | Deployment Size |       |        |       |         |
| 242379                                                                                       | 1090            |       |        |       |         |
| Function Name                                                                                | min             | avg   | median | max   | # calls |
| createClone                                                                                  | 63750           | 63750 | 63750  | 63750 | 1       |