8000 Speedup EventBus.PublishEventTx · Issue #2869 · cometbft/cometbft · GitHub 8000
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Speedup EventBus.PublishEventTx  #2869
Open
@ValarDragon

Description

@ValarDragon

Feature Request

Summary

In a block sync of 5000 blocks on Osmosis mainnet, we see 23 seconds out of 1050 in EventBus.PublishEventTx (2.1% of the ApplyBlock time), this should likely also impact live syncing blocks as it affects ApplyBlock.

image

Most of this time is time that doesn't even need to be spent!

Proposal

  • First notice that we spend 10.4 seconds in zerologger.With which is only here! However in the function we pass it into here, that time is only used in Debug logs. So we should just refactor the API's to only pay that cost if we are in debug mode. We just need to refactor that API to pass the base logger in, and only do the With call as a LazyLogger I think, that also only gets called if we are in that error case.
  • The fmt.Sprintf call taking 3.5 seocnds here should be able to live in a cache, since there should be a small number of composite tags. Perhaps we add an LRU cache of size (say) 20000 to cache these?

We should be able to speed this up notably more beyond these two improvements, but figured it may be worth writing up these two and getting it deployed in benchmarks first

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageThis issue/PR has not yet been triaged by the team.

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0