-
Notifications
You must be signed in to change notification settings - Fork 377
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
feat(x/params): add lru caching #3120
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3120 +/- ##
==========================================
- Coverage 63.79% 63.75% -0.04%
==========================================
Files 549 549
Lines 78819 79468 +649
==========================================
+ Hits 50279 50664 +385
- Misses 25150 25388 +238
- Partials 3390 3416 +26
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the performance gains of this PR? K/V storages usually have cache mechanisms like the one implemented here, so maybe it is redundant?
EventSwitch events.EventSwitch // required | ||
VMOutput io.Writer // optional | ||
InitChainerConfig // options related to InitChainer | ||
ParamsMaxCacheSize int // optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the int representing? Kb? Mb? The number of items?
@@ -7,6 +7,7 @@ import ( | |||
"github.com/gnolang/gno/tm2/pkg/amino" | |||
"github.com/gnolang/gno/tm2/pkg/sdk" | |||
"github.com/gnolang/gno/tm2/pkg/store" | |||
"github.com/golang/groupcache/lru" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this lib is more maintained than the one used: https://github.com/hashicorp/golang-lru
if bz == nil { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the meaning of that code? can we have nil values in our cache? why?
LRU caching uses a specified
CacheMaxSize
to limit the number of entries. Keys are immediately invalidated when a setter is called. The LRU is shared across all the getters.Fix #3023
Related with #2911