Commit 2fd3508
committed
apacheGH-3522: Optimize IntList.size() from O(slabs) to O(1) with running counter
IntList.size() was iterating over all slabs to sum their lengths on every
call. Replace with a simple totalSize counter incremented on each add().
This eliminates O(slabs) overhead from dictionary encoding hot paths where
size() is called frequently.1 parent 53d7842 commit 2fd3508
1 file changed
Lines changed: 3 additions & 6 deletions
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 155 | + | |
159 | 156 | | |
160 | 157 | | |
0 commit comments