[issue35369] List sorting makes duplicate comparisons

2018-12-02 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Pyth

[issue35369] List sorting makes duplicate comparisons

2018-12-01 Thread David Wyde
David Wyde added the comment: Okay. Thanks! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue35369] List sorting makes duplicate comparisons

2018-12-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I've heard of using human choices for comparisons, when fewer decisions could > provide a notable speedup. Memoization is the usual solution when expensive computations are being repeated. That technique preserves the work that was done and it avoids a

[issue35369] List sorting makes duplicate comparisons

2018-12-01 Thread David Wyde
David Wyde added the comment: Thanks for the speedy and helpful response. Keeping complexity down is fair. The wasted if-checks on subsequent iterations are certainly a negative trade-off. I saw that binarysort() is only called in one place, but I understand wanting to keep it generic. I th

[issue35369] List sorting makes duplicate comparisons

2018-11-30 Thread Tim Peters
Tim Peters added the comment: Yup, it can do some redundant comparisons; more on that here: https://mail.python.org/pipermail/python-dev/2018-August/155020.html I'm not inclined to make this already-difficult code even harder to understand for something that's quite likely not to matter - or

[issue35369] List sorting makes duplicate comparisons

2018-11-30 Thread David Wyde
Change by David Wyde : Added file: https://bugs.python.org/file47963/sort.py ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue35369] List sorting makes duplicate comparisons

2018-11-30 Thread David Wyde
New submission from David Wyde : Python's Timsort sometimes makes the same comparison twice. This leads to extra compares, which can hurt performance. Python sorts several length-3 permutations in 4 steps, and the problem accumulates with bigger data. There are ~9,800 duplicate less-than chec