Message 327914 - Python tracker

Message327914

Author cykerway
Recipients cykerway, serhiy.storchaka, steven.daprano, tim.peters, xtreak
Date 2018-10-17.22:33:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1539815640.06.0.788709270274.issue35010@psf.upfronthosting.co.za>
In-reply-to
Content
As for performance, I think both single-pass and multi-pass sorts have worst-case time complexity `m * n * log(n)`, assuming the number of items is `n` and each item has dimension `m`. Whichever is faster seems to be data-dependent. So I made a more comprehensive performance evaluation in `performance-1.py`. It turns out either single-pass or multi-pass can be 80-100% faster than the other, on different inputs.

Since single-pass and multi-pass sorts are good at different inputs and there is currently no statistics on real application data supporting either, both look OK to me. But I hope you can add something in the interface of sorting functions (mainly `sorted` and `list.sort`) so that users don't have to write that multi-pass sort again and again. If the `keyspec` format is deemed too complicated, `keys` and `reverses` also look good to me:

    sorted(items, keys=(key0, key1, key2), reverses=(True, False, True))

And you are free to use whatever sorting algorithms in its implementation for this kind of task.
History
Date User Action Args
2018-10-17 22:34:00cykerwaysetrecipients: + cykerway, tim.peters, steven.daprano, serhiy.storchaka, xtreak
2018-10-17 22:34:00cykerwaysetmessageid: <1539815640.06.0.788709270274.issue35010@psf.upfronthosting.co.za>
2018-10-17 22:34:00cykerwaylinkissue35010 messages
2018-10-17 22:33:59cykerwaycreate