makoto / blockparty

NO BLOCK NO PARTY
MIT License
164 stars 41 forks source link

Performance Optimisation #74

Closed makoto closed 7 years ago

makoto commented 7 years ago

The existing solution hit gas limit when payback to more than 200 people due to the linear gas increase.

The change now allows the almost infinite number of registration.

Gas usage of registering 200 people

Before

type         gasUsed   gasPrice   1ETH*USD  gasUsed*gasPrice(Ether) gasUsed*gasPrice(USD)
*create     1657606     2   303 0.003315212 1.004509236
register    142118      2   303 0.000284236 0.086123508
attend      51221       2   303 0.000102442 0.031039926000000002
*payback    4583215     2   303 0.00916643  2.77742829
withdraw    55543       2   303 0.000111086 0.033659058

After

type         gasUsed      gasPrice 1ETH*USD gasUsed*gasPrice(Ether) gasUsed*gasPrice(USD)
*create     1594546     2   303 0.003189092 0.9662948760000001
register    117039      2   303 0.000234078 0.070925634
attend      51243       2   303 0.000102486 0.031053257999999997
*payback    83288       2   303 0.000166576 0.050472528
withdraw    35671       2   303 0.000071342 0.021616626

NOTE: * are the admin only operations