Antoine Pitrou added the comment: Here is a much faster patch, around 30x faster than the original code.
With exhuma's data set and tester.py, the original code gives: $ time python3.4 tester.py Execution time: 5.949284339199949 seconds real 0m30.152s user 0m30.104s sys 0m0.016s The patched code gives: $ time ./python tester.py Execution time: 0.25444041779992405 seconds real 0m1.695s user 0m1.681s sys 0m0.012s exhuma, perhaps you want to test with other data sets? ---------- Added file: http://bugs.python.org/file35228/faster_collapse.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20826> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com