Closed zztaki closed 10 months ago
If you think this makes sense, I'm glad to do PRs to optimize LRUCache, TimedLRUCache and SglLRUCache without affecting the semantics. :)
If you think this makes sense, I'm glad to do PRs to optimize LRUCache, TimedLRUCache and SglLRUCache without affecting the semantics. :)
Good catch, just do it! Maybe you could use google/benchmark to evaluate impremovement.:)
If you think this makes sense, I'm glad to do PRs to optimize LRUCache, TimedLRUCache and SglLRUCache without affecting the semantics. :)
Good catch, just do it! Maybe you could use google/benchmark to evaluate impremovement.:)
Nice tool! I will try it and submit a PR soon~
Is your feature request related to a problem? (你需要的功能是否与某个问题有关?) In
src/common/lru_cache.h
,LRUCache
's methodMoveToFront
will do copying the requested elem, erasing the elem from list, pushing duplica to the list's head, and even updating the hashtable. This will waste time.Describe the solution you'd like (描述你期望的解决方法)
list.splice
is OK instead of the above steps.Describe alternatives you've considered (描述你想到的折衷方案)
Additional context/screenshots (更多上下文/截图) I've done some performance testing with
epoch = 1000000
.Result is