EspressoSystems / cape

Configurable Asset Privacy for Ethereum
https://cape.docs.espressosys.com/
GNU General Public License v3.0
93 stars 16 forks source link

Drop write lock before persisting to disk #1192

Closed sveitser closed 2 years ago

sveitser commented 2 years ago

Also adds a few info logs related to EQS activity.

I think this is preferable to operating on a copy because all operations on the state go through the RWLock directly. In my experiments this reduced the lock time from up 1 second to about 40ms. The less safe alternative (making a copy and then acquiring a write lock to write back the modified copy) locks for about 20ms. However with the second version it would be possible to operate on more than one copy simultaneously, thereby ending up with a wrong state.