-
Notifications
You must be signed in to change notification settings - Fork 616
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: use lru
instead of cached
in near-network
#5512
Conversation
|
This conflicts with
|
Downgrading |
Ah, that's unfortunate. But yeah, I feel it's better to not pull yet another copy of hashbrown. Fixing this properly (by updating, rather than downgrading) would require near/borsh-rs#45, near/borsh-rs#46, and removing |
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.
Yeah, lru looks much, much more reasonable than sized cache. When this is merged, I'll update contract runtime usage of cached s well.
1c96961
to
acc1052
Compare
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.
Question: are we confident in the lru implementation?
Without carefully reading every line of code, I am personally more confident in I've also noticed an opportunity for optimization there: jeromefroe/lru-rs#119. Trying to implement that might be a fun way to audit the crate. |
acc1052
to
f192942
Compare
@mm-near I looked at the implementation of |
064cad0
to
d3f9a32
Compare
This is just a proof of concept. Implement a cache that works from a "&" context. - get_from_cache_or_insert - gets a value or inserts a computed value - get_from_cache - tries to get value TODO: - [x] rename methods - [x] add new methods - [x] benchmarks - [x] comments - [x] add more tests. - [x] one example of replacing real code - [x] implement example with `lru` (done in another PR) - [x] Use `once_cell` instead of `lazy_static!` (done in another PR). See #5145 Was blocked by: #5512
This is just a proof of concept. Implement a cache that works from a "&" context. - get_from_cache_or_insert - gets a value or inserts a computed value - get_from_cache - tries to get value TODO: - [x] rename methods - [x] add new methods - [x] benchmarks - [x] comments - [x] add more tests. - [x] one example of replacing real code - [x] implement example with `lru` (done in another PR) - [x] Use `once_cell` instead of `lazy_static!` (done in another PR). See #5145 Was blocked by: #5512
This is just a proof of concept. Implement a cache that works from a "&" context. - get_from_cache_or_insert - gets a value or inserts a computed value - get_from_cache - tries to get value TODO: - [x] rename methods - [x] add new methods - [x] benchmarks - [x] comments - [x] add more tests. - [x] one example of replacing real code - [x] implement example with `lru` (done in another PR) - [x] Use `once_cell` instead of `lazy_static!` (done in another PR). See #5145 Was blocked by: #5512
This is just a proof of concept. Implement a cache that works from a "&" context. - get_from_cache_or_insert - gets a value or inserts a computed value - get_from_cache - tries to get value TODO: - [x] rename methods - [x] add new methods - [x] benchmarks - [x] comments - [x] add more tests. - [x] one example of replacing real code - [x] implement example with `lru` (done in another PR) - [x] Use `once_cell` instead of `lazy_static!` (done in another PR). See #5145 Was blocked by: #5512
This is just a proof of concept. Implement a cache that works from a "&" context. - get_from_cache_or_insert - gets a value or inserts a computed value - get_from_cache - tries to get value TODO: - [x] rename methods - [x] add new methods - [x] benchmarks - [x] comments - [x] add more tests. - [x] one example of replacing real code - [x] implement example with `lru` (done in another PR) - [x] Use `once_cell` instead of `lazy_static!` (done in another PR). See #5145 Was blocked by: #5512
…#5595) While reading `get_announce` implementation, I noticed that for every `AnnounceAccount` read, we were writing it back to disk. Let's simplify `get_announce` to avoid additional disk writes. Based on top of #5512 TODO after this PR: - [ ] more cleanup of `RoutingTableView` Testing: We have tests for this code
use
lru
instead ofcached
innear-network
Reasons:
cached
in my benchmarksLruCache
uses more standard api nameput
/get
etc.LruCache
vscached