Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: caching parameters and other stuff in transient object store #19841

Closed
yihuang opened this issue Mar 23, 2024 · 2 comments
Closed

Comments

@yihuang
Copy link
Collaborator

yihuang commented Mar 23, 2024

Summary

Support transient object store that caches interface{} instead of []byte.

Problem Definition

We have many GetParams calls, and although the store layer cached the raw bytes, we still have to do the decoding, which sometimes has non-trivial costs (e.g. in ethermint), and this cost happens multiple times for each transaction, for example, auth keeper's GetParams() is called multiple times in ante handlers, and when we have many transactions in a block, the accumulated cost is actually pretty significant, which is revealed by our profiling.

Proposed Feature

Add an object store type, and a different store interface that supports interface{} as value type instead of []byte.

Then we can cache the parameters very effectively since it's rarely updated, most of the time, we only need to load and decode once for each block.

There are also other things worthy to cache other than the parameters, actually most of the use cases for transient/memory stores should probably use an object store.

Implementation

crypto-org-chain#206

@tac0turtle
Copy link
Member

tac0turtle commented Mar 23, 2024

this is a duplicate of #19223.

since the sdk uses collections we will aim to integrate this in there instead in the native store

@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🥳 Done in Cosmos-SDK Mar 23, 2024
@yihuang
Copy link
Collaborator Author

yihuang commented Mar 24, 2024

I don't know how we can approach this without touching storage layer, because we need to deal with branching stuff, and we also need it to store arbitrary objects that's not loaded from storage, it can for example used in fee collection.

@tac0turtle tac0turtle removed this from Cosmos-SDK Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants