← Back to team overview

larry-discuss team mailing list archive

Faster binary operations

 

One of the performance bottlenecks of larry are binary operations (+,
-, /, *, &, |) on large unaligned larrys. The alignment time is O(N^2)
since the location of each label element in the left hand and right
hand larrys (N) is looked up in the label of the combined larry (M).
(So really O(N*M).) To speed things up I switched to a O(N) mapping.
That gave a speedup of 80x for binary operations on two unaligned
larrys of shape (10000,). The cost is a 2% slowdown for unaligned
larrys of shape (10,).

Here's the change:

http://bazaar.launchpad.net/~kwgoodman/larry/trunk/revision/260