Hacker News new | ask | show | jobs
by taeric 811 days ago
It is hilarious how much space you can save by using smaller indexes than a pointer. Especially on modern architectures.
1 comments

Yes! The regex crate does this and it saves quite a bit of memory.
It 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