The documentation around emitting events states that events are written to storage, and then cleared next block.
This has considerable costs
- You add extra db write/read overhead to practically every extrinsic, and cleanup, making extrinsics more expensive and wasting block weight.
- As the log of events grows during block execution, the object being written back and forth to the underlying database becomes bigger and bigger, because its all one big
Vec
.
I have three questions about this
- What is the benefit of this writing to storage, and why is this the default?
- What is the downside of removing this writing to storage? does it cause some cascade of other changes one has to make?
- Should we be seeing this cost, and the dbwrite, in our benchmarking? because we currently are not.