Merging sorted lists/iterators/generators into one stream of values...

Lasse Vågsæther Karlsen lasse at vkarlsen.no
Sat Oct 8 14:35:49 EDT 2005


George Sakkis wrote:
<snip>
> Just added a recipe at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440673. You can try
> both and see if there's any significant performance difference for your data.
<snip>

Thanks, will take a look at it later. The sort solution seems to work 
nicely. Might be a big difference if I have a lot of sources though as I 
bet the overhead in doing a sort of N items gets higher than doing a 
manipulation of a heap to place an item in the right spot, but with 4-5 
or a few more sources might not make an impact at all.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:lasse at vkarlsen.no
PGP KeyID: 0x2A42A1C2



More information about the Python-list mailing list