On Fri, 19 Dec 2008 08:33:28 +1000 "James Mills" <prolo...@shortcircuit.net.au> wrote:
> > The dict that I tried out is of the type: > > > > {(1,2,3): "2323", (1,2,545): "2324234", ... } > > > > It is too slow for my application when it grows. One slicing > > operation with list comprehensions takes about 1/2 s on my computer > > for 1E6 elements. > > Let me get this straight. > It's taking 0.5s to slice your matrix > of 1E7 (10000000.0 rows/columns) My benchmark is as follows: 1) Each of the numbers in the 3-tuple is in the range [0, 1E7). 2) There are 1 000 000 elements in the dict (randomly distributed). 3) The content string is a random number in the range [0, 1E10) that is casted into a string. 4) Measure the time that retrieving all elements in a 10000x100x10 cube requires. > Are you mad ? This is TEN Millions and you > required it faster than 0.5s ? Think about how often a spreadsheet re-calculates cells. Furthermore, people tend to copy&paste cells. I had some small example (Wagner-Whitin algorithm demo) with hundreds of slicing operations on one screen. I believe that no-one wants to wait for 1/2 s times 500 == 250 s each time the spreadsheet is updated. Martin -- http://mail.python.org/mailman/listinfo/python-list