Commit 2711aed
committed
LargePalette: avoid paying upfront performance penalty for cache population
This made the creation of large palettes 100x slower.
By harnessing the scans that we would've done on writes previously
anyway, we can lazily populate the map when the element isn't found
in the map. Performance of write is therefore no worse than previous
for the first write, and for subsequent ones will always be faster.
Since many palettes go their entire lifespan without being modified,
it doesn't make much sense to pay an up-front performance penalty.1 parent 3a50408 commit 2711aed
1 file changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
| |||
150 | 148 | | |
151 | 149 | | |
152 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
153 | 166 | | |
154 | 167 | | |
155 | 168 | | |
| |||
0 commit comments