Commit 1cdc668
committed
perf: store Tablet.replicas as tuple instead of list
Replicas are never mutated after Tablet construction; convert to tuple
in __init__ to save 8 bytes per tablet (list overallocates for future
appends that never happen) and communicate immutability.
Before: 328 bytes/tablet (replicas container: 80 bytes as list)
After: 320 bytes/tablet (replicas container: 72 bytes as tuple)
Saving: 8 bytes/tablet (2.4%)
Combined with __slots__ (commit 1), total savings so far: 96 bytes/tablet.
Scale impact (3 replicas/tablet):
128,000 tablets: saves ~1.0 MB (tuple) + 10.7 MB (slots) = 11.7 MB total
256,000 tablets: saves ~2.0 MB (tuple) + 21.5 MB (slots) = 23.5 MB total1 parent 9b843f2 commit 1cdc668
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
0 commit comments