celestiaorg / celestia-core

A fork of CometBFT
Apache License 2.0
488 stars 267 forks source link

Avoid useless allocations in the mempool #1251

Open evan-forbes opened 8 months ago

evan-forbes commented 8 months ago

We are formatting all transactions to pass to the debug logger in the mempool. This results in a large number of allocations that are not necessary unless the debug/info logger is actually being used. We should find a way to stop that. One way might be to use the lazy version of the fmt.Sprintf, which shouldn't actually perform any formatting unless the logger is actually being used.

https://github.com/celestiaorg/celestia-core/blob/931911418f760cf6a01e9fbde6aa9734249d0742/mempool/v1/reactor.go#L207-L209

Screenshot from 2024-02-29 11-51-13

evan-forbes commented 5 months ago

There are many different changes in the osmosis fork of comet that we could pick up alongside this.