@@ -5,12 +5,13 @@ that require larger refactoring to address.
55
66## Performance
77
8- ### LPUSH / list mutations are O(N)
9- - ** Location** : ` redis_compat_commands.go ` (lpush, ltrim, rpush)
10- - ** Problem** : List modification commands read the entire list, modify in memory,
11- and rewrite the whole list. This is O(N) where N is the number of elements.
12- - ** Fix** : Push list manipulation down into the storage layer so individual
13- elements can be appended/removed without full rewrite.
8+ ### LTRIM is O(N)
9+ - ** Location** : ` redis_compat_commands.go ` (ltrim)
10+ - ** Problem** : LTRIM reads the entire list, trims in memory, and rewrites.
11+ This is O(N) where N is the number of elements.
12+ - ** Fix** : Implement range deletion at the storage layer to trim without full
13+ rewrite. LPUSH and RPUSH have been optimized to O(k) using store-level
14+ sequence number operations.
1415
1516### SCAN materializes all keys
1617- ** Location** : ` redis_compat_commands.go ` (scan)
@@ -20,10 +21,11 @@ that require larger refactoring to address.
2021- ** Fix** : Implement SCAN as an incremental range scan over the underlying store,
2122 returning the next cursor based on the last returned key.
2223
23- ### FLUSHDB iterates all keys
24+ ### FLUSHDB single-pass but no range deletion
2425- ** Location** : ` redis_compat_commands.go ` (flushdb)
25- - ** Problem** : FLUSHDB/FLUSHALL iterates through all visible keys and deletes
26- them one by one. This can be very slow for large datasets.
26+ - ** Problem** : FLUSHDB/FLUSHALL scans the entire store and generates per-key
27+ delete operations. While optimized to a single scan (no per-key existence
28+ checks), it still creates individual delete mutations for each key.
2729- ** Fix** : Implement a range deletion capability at the storage layer.
2830
2931### visibleKeys N x M per-key type checks
0 commit comments