Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • Thank-you so much for your timings as it was exactly what I was wondering. The motivation for my question was that our lists and lists-of-lists are very large (in the millions) and will get larger over time. We use Numpy vectorization extensively and this was the only for-loop remaining in the system. Commented Jan 2, 2012 at 19:24
  • Very nice, but import itertools should be put in the setup, not the method. 2.89 seconds for Nlists=10 seems fishy. Commented Jan 2, 2012 at 19:52
  • Also, if you change map to itertools.imap, it might make some difference. Commented Jan 2, 2012 at 19:55
  • @JoshAdel, nice. I'd be curious to see how my numpy.histogram solution stacks up to the above... Commented Jan 2, 2012 at 20:03
  • @dbv if the number is in the millions, vectorization might provide significant speedup if you don't run into memory issues. I also think taking a look at cython is a good idea. I've personally had a lot of success with it in the past for getting large speed-ups for things that either don't vectorize well or would have required a large intermediate array that didn't fit into memory. Commented Jan 2, 2012 at 20:04