-
Notifications
You must be signed in to change notification settings - Fork 216
feat: new experimental gc friendly flatten cache #712
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
base: main
Are you sure you want to change the base?
Conversation
5f5d6b5
to
8520080
Compare
Signed-off-by: Rueian <rueiancsie@gmail.com>
8520080
to
b2d37ed
Compare
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
82a112a
to
c0e7210
Compare
Signed-off-by: Rueian <rueiancsie@gmail.com>
c0e7210
to
35822ea
Compare
Signed-off-by: Rueian <rueiancsie@gmail.com>
…Update Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
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.
Pull Request Overview
Introduces a new experimental GC-friendly flatten cache implementation by adding a time.Time
parameter to the Update
method signature across the caching system. This change enables better temporal tracking and supports the implementation of a new chained cache structure with improved memory management.
Key changes:
- Updated
Update
method signature to includetime.Time
parameter - Added new cache data structures in
internal/cache
package with optimized memory layout - Implemented
NewChainedCache
as an experimental alternative to the default cache
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pipe_test.go | Updated test calls to include time parameter in cache Update method |
pipe.go | Modified cache Update calls to pass current time |
lru_test.go | Updated all test cases to use new Update method signature |
lru.go | Added time parameter to Update method (parameter is unused) |
internal/cache/lru_test.go | Added comprehensive tests for new LRU double map implementation |
internal/cache/lru.go | Implemented new LRU double map with GC-friendly design |
internal/cache/double_test.go | Added tests for new double map data structure |
internal/cache/double.go | Implemented core double map functionality |
internal/cache/chain_test.go | Added tests for chain data structure |
internal/cache/chain.go | Implemented linked chain for hash collision handling |
cache_test.go | Updated test calls and added test for new flatten cache |
cache.go | Updated Update method signature and implemented new chained cache |
Comments suppressed due to low confidence (1)
lru.go:221
- [nitpick] The parameter name
_
(blank identifier) indicates the time parameter is intentionally unused. Consider using a more descriptive name likenow
ortimestamp
for better code readability, even if the parameter is currently unused.
func (c *lru) Update(key, cmd string, value RedisMessage, _ time.Time) (pxat int64) {
m.bp.New = func() any { | ||
e := &empties{s: make([]string, 0, bpsize)} | ||
runtime.SetFinalizer(e, func(e *empties) { | ||
if len(e.s) >= 0 { |
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.
The condition len(e.s) >= 0
is always true since slice length is never negative. This should likely be len(e.s) > 0
to only delete when there are actually entries to process.
if len(e.s) >= 0 { | |
if len(e.s) > 0 { |
Copilot uses AI. Check for mistakes.
No description provided.