[Numpy-discussion] Announcing tinyarray

Christoph Groth cwg@falma...
Thu Aug 1 17:34:11 CDT 2013


Almost two years ago a discussion on this list took place under the
subject "speeding up operations on small vectors".  The issue was the
rather high constant time and space overhead of small NumPy arrays.  I'm
aware that in general one should combine small arrays into large ones,
but there are cases where this is not feasible.

So, today, I'm pleased to announce a Python package that provides an
alternative for those who would like or have to use many small arrays of
numbers in Python: Tinyarray


Tinyarray is a numerical array module for Python.  The multi-dimensional
arrays it provides are best thought of as (possibly nested) tuples of
numbers that, unlike Python's built-in tuples, support mathematical
operations.  Like tuples, tinyarrays are hashable and immutable and thus
can be used as dictionary keys.  The module's interface is a subset of
that of NumPy and hence should be familiar to many Python programmers.
Tinyarray has been heavily optimized for small arrays: For example,
common operations on 1-d arrays of length 3 run up to 35 times faster
than with NumPy.  When storing many small arrays, memory consumption is
reduced by a factor of 3.  In summary, Tinyarray is a more efficient
alternative to NumPy when many separate small numerical arrays are to be

I will be happy to hear comments and suggestions, and I will gladly
accept useful patches.  As I will be traveling the next days, I may not
be very responsive.


More information about the NumPy-Discussion mailing list