Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That'd be why he said "arrays weren't designed to store integers efficiently".


From the comment:

> then you should use one of the many alternative structures available. Some of them were explicitly designed to store integers in an efficient manner.

From the article:

> But if you do want to save memory you could consider using an SplFixedArray for large, static arrays. ... It basically does the same thing, but if you run it, you’ll notice that it uses “only” 5600640 bytes. That’s 56 bytes per element ...

EDIT: formatting.


That is only one of the alternatives and in my opinion, not a very good one. I forget the exact details, but there is an extension by the guy who wrote igbinary that is specifically designed for this use-case.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: