3 ms·
It is hilarious how much space you can save by using smaller indexes than a pointer. Especially on modern architectures.
by taeric 3y ago
It is hilarious how much space you can save by using smaller indexes than a pointer. Especially on modern architectures.
- burntsushi 3y agoYes! The regex crate does this and it saves quite a bit of memory.
- taeric 3y agoIt is the kind of low hanging optimization that I used to think was greatly oversold. And, to be fair, for many programs I would still wager it probably is. If you are chasing a ton of pointers, though, it is definitely worth considering how many more you can hold in memory with smaller sizes. I think I remember a discussion a while back lamenting that we just tacitly accepted wide pointers. If anyone has a link going over that, I'd be delighted to read it again. I'm 90% sure I did not understand it when I first saw it. :D