3 ms·
Option #3(indexed tree) looks non-ideal but it actually has some really cool properties if you do it right. 1. If you know traversal order you can get really g
by vvanders 9y ago
Option #3(indexed tree) looks non-ideal but it actually has some really cool properties if you do it right.
1. If you know traversal order you can get really great cache coherency. We used to do this all the time with animation DAGs and the like in gamedev.
2. If everything is an "offset"/index instead of a pointer you can do things like in-place loading where creating something is just a single read() call. No constructors or annoying allocations to slow down loading. If you want to take this even further you can mmap() the entire file on disk and use massive(500mb+) files without using much actual memory overhead through letting the kernel page it in/out for you.
- Narishma 9y ago> 1. If you know traversal order you can get really great cache coherency. Cache locality, not coherency.
- vvanders 9y agoSorry yes, had a brain fart there.
- stjepang 9y agoWhy does option #3 look non-ideal, what are your concerns with it?
- vvanders 9y agoWell, non-ideal may be poor phrasing. I guess I meant to say it doesn't look like the "classic" linked list implementation.