perf: reduce memory overhead per entry - #52
Merged
Conversation
- remove size field from Entry (compute on demand): -8 bytes - use u64 timestamp instead of Option<Instant> for expiry: -8 bytes - use Box<str> instead of String for keys in concurrent mode: -8 bytes - add time.rs module for compact monotonic timestamps total savings: ~24 bytes per entry in concurrent mode
- throughput: 1.86M SET/sec, 2.48M GET/sec (1.85-2.14x vs redis) - memory: 257 bytes/key (down from 307, 16% reduction) - non-pipelined: 2x faster than redis (200k vs 100k ops/sec)
kacy
added a commit
that referenced
this pull request
Feb 11, 2026
* perf: reduce memory overhead per entry - remove size field from Entry (compute on demand): -8 bytes - use u64 timestamp instead of Option<Instant> for expiry: -8 bytes - use Box<str> instead of String for keys in concurrent mode: -8 bytes - add time.rs module for compact monotonic timestamps total savings: ~24 bytes per entry in concurrent mode * docs: update benchmarks with memory optimization results - throughput: 1.86M SET/sec, 2.48M GET/sec (1.85-2.14x vs redis) - memory: 257 bytes/key (down from 307, 16% reduction) - non-pipelined: 2x faster than redis (200k vs 100k ops/sec) * style: fix formatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
reduces memory overhead per entry by ~20% through:
Option<Instant>(16 bytes) withu64timestamps (8 bytes)size: usizefield from Entry (computed on demand)Box<str>instead ofStringfor keys in concurrent mode (24→16 bytes)introduces a shared
timemodule for compact monotonic timestamps.benchmark results
memory test (1M keys, 64-byte values):
throughput test (no regression):
tested
cargo clippyclean