For image processing, I need an array (array type, not numpy array) for 2 million 32 bit words. If I use something like:
tb = array.array( 'i', ,(0,)*2000000)
it requires 126 msec. It's large and I don't even need to initialize the array. I don't know Python internals but I assume that the statement generate tons on malloc() (memory allocator) and free() (memory deallocator).
Is there another way to create a very large Python array?