On 10/11/2016 10:26 AM, Chris Angelico wrote:

After the first call, the list will be sorted. Any subsequent attempts
will use the sorted list.

This seems like a generic issue with timing mutation methods. Is the mutated output suitable input for another mutation. With list.reverse, the output is suitable. Ditto for other permutations that are independent of the data, including random.shuffle. With list.pop, the number of mutations has to be limited to the length of the list. With list.sort, the list needs to be 'restored' -- either copied or shuffled each time. So it seems that one is stuck with timing 'restore', restore + sort_a, restore + sort_b, subtracting the timing for restore, and comparing. But I am sure Tim worked this out in his test code, which should be reused, perhaps updated with Viktor's perf module to get the most stable timings possible.

--
Terry Jan Reedy

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to