[Python-Dev] Optimizing list.sort() by checking type in advance
Paul Moore
p.f.moore at gmail.com
Tue Oct 11 11:12:12 EDT 2016
More information about the Python-Dev mailing list
Tue Oct 11 11:12:12 EDT 2016
- Previous message (by thread): [Python-Dev] Optimizing list.sort() by checking type in advance
- Next message (by thread): [Python-Dev] Optimizing list.sort() by checking type in advance
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 11 October 2016 at 15:32, Elliot Gorokhovsky <elliot.gorokhovsky at gmail.com> wrote: > But the sort mutates F...does the setup get executed each time? I thought > it's just at the beginning. So then F gets mutated (sorted) and subsequent > sorts time wrong. Did I not say earlier - sorry. I'm suggesting that you put each timing run into a separate Python process. # Optimised code python -m perf timeit -s "from mymod import FastList; L=<whatever you do to create the list>;F=FastList(L)" "F.fastsort()" # Core sort routine python -m perf timeit -s "L=<whatever you do to create the list>" "L.sort()" # Or maybe, if FastList exposes the existing sort function as well # Non-optimised code python -m perf timeit -s "from mymod import FastList; L=<whatever you do to create the list>;F=FastList(L)" "F.sort()" Paul.
- Previous message (by thread): [Python-Dev] Optimizing list.sort() by checking type in advance
- Next message (by thread): [Python-Dev] Optimizing list.sort() by checking type in advance
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list