4 ms·
I wouldn't call using 56 bytes to store 8 bytes of actual data efficient.
by mbell 15y ago
I wouldn't call using 56 bytes to store 8 bytes of actual data efficient.
- dangrossman 15y agoThat'd be why he said "arrays weren't designed to store integers efficiently".
- ktr 15y agoFrom 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.
- maratd 15y agoThat 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.