My project currently uses NumPy, only for memory-efficient arrays (of bool_, uint8, uint16, uint32).
I'd like to get it running on PyPy which doesn't support NumPy. (failed to install it, at any rate)
So I'm wondering: Is there any other memory-efficient way to store arrays of numbers in Python? Anything that is supported by PyPy? Does PyPy have anything of it's own?
Note: array.array is not a viable solution, as it uses a lot more memory than NumPy in my testing.
array.array is a memory efficient array. It packs bytes/words etc together, so there is only a few bytes of extra overhead for the entire array.
The one place where numpy can use less memory is when you have a sparse array (and are using one of the sparse array implementations)
If you are not using sparse arrays, you simply measured it wrong.
array.array also doesn't have a packed bool type, so you can implement that as wrapper around an array.array('I') or a bytearray() or even just use bit masks with a Python long
PyPy and efficient arrays