Commit 5cc8860
authored
perf(TS): Reduce TS memory by slimming down internal LevelInfo size (#4337)
Reduces the memory footprint of the `LevelInfo` struct. Three changes
are here, in order of most to least impactful:
- Makes one `ImageSpec` optional, most of the time `spec` and
`nativespec` are the same, it appears they are only different when
autotile is enabled, this saves about 160 bytes.
- Uses `std::unique_ptr<float[]>` (8 bytes) instead of
`std::vector<float>` (24 bytes).
- Reorders members to remove excess padding.
We noticed this memory usage on scenes with per-face textures with
multiple mips per face. For a scene with 12.5 million mips, this saves
about 2GB.
Note, it would probably also be possible to remove the
`polecolorcomputed` member, instead relying on the `polecolor` pointer.
But since this bool occupies existing padding in the struct it wouldn't
save any memory currently.
---------
Signed-off-by: Curtis Black <curtis.w.black@gmail.com>1 parent 736d253 commit 5cc8860
3 files changed
Lines changed: 61 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| |||
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 254 | + | |
259 | 255 | | |
260 | 256 | | |
261 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
262 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
263 | 269 | | |
264 | 270 | | |
265 | 271 | | |
| |||
563 | 569 | | |
564 | 570 | | |
565 | 571 | | |
566 | | - | |
567 | | - | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
568 | 575 | | |
569 | 576 | | |
570 | 577 | | |
| |||
598 | 605 | | |
599 | 606 | | |
600 | 607 | | |
| 608 | + | |
601 | 609 | | |
602 | 610 | | |
603 | 611 | | |
| |||
620 | 628 | | |
621 | 629 | | |
622 | 630 | | |
623 | | - | |
624 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
625 | 639 | | |
626 | 640 | | |
627 | 641 | | |
| |||
663 | 677 | | |
664 | 678 | | |
665 | 679 | | |
666 | | - | |
| 680 | + | |
667 | 681 | | |
668 | 682 | | |
669 | 683 | | |
| |||
1583 | 1597 | | |
1584 | 1598 | | |
1585 | 1599 | | |
1586 | | - | |
| 1600 | + | |
| 1601 | + | |
1587 | 1602 | | |
1588 | | - | |
1589 | | - | |
1590 | | - | |
1591 | | - | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
1592 | 1606 | | |
1593 | 1607 | | |
1594 | 1608 | | |
1595 | 1609 | | |
1596 | 1610 | | |
1597 | | - | |
| 1611 | + | |
1598 | 1612 | | |
1599 | 1613 | | |
1600 | 1614 | | |
| |||
3586 | 3600 | | |
3587 | 3601 | | |
3588 | 3602 | | |
3589 | | - | |
3590 | | - | |
| 3603 | + | |
| 3604 | + | |
| 3605 | + | |
3591 | 3606 | | |
3592 | 3607 | | |
3593 | 3608 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
254 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
255 | 259 | | |
256 | 260 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
262 | 264 | | |
263 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
264 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
265 | 274 | | |
266 | 275 | | |
267 | 276 | | |
| |||
278 | 287 | | |
279 | 288 | | |
280 | 289 | | |
281 | | - | |
282 | 290 | | |
| 291 | + | |
283 | 292 | | |
284 | 293 | | |
285 | 294 | | |
| |||
294 | 303 | | |
295 | 304 | | |
296 | 305 | | |
297 | | - | |
298 | | - | |
| 306 | + | |
| 307 | + | |
299 | 308 | | |
300 | 309 | | |
301 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1981 | 1981 | | |
1982 | 1982 | | |
1983 | 1983 | | |
1984 | | - | |
| 1984 | + | |
1985 | 1985 | | |
1986 | 1986 | | |
1987 | 1987 | | |
1988 | 1988 | | |
1989 | | - | |
1990 | | - | |
| 1989 | + | |
| 1990 | + | |
1991 | 1991 | | |
1992 | 1992 | | |
1993 | 1993 | | |
| |||
0 commit comments