Re: [Python-ideas] Optimizing list.sort() by checking type in advance

2016-10-10 Thread Greg Ewing
Elliot Gorokhovsky wrote: if the list is all floats, just copy all the floats into a seperate array, use the standard library quicksort, and then construct a sorted PyObject* array. My question would be whether sorting list of just floats (or where the keys are just floats) is common enough

Re: [Python-ideas] Optimizing list.sort() by checking type in advance

2016-10-10 Thread Jonathan Goble
On Mon, Oct 10, 2016 at 11:30 PM Elliot Gorokhovsky < elliot.gorokhov...@gmail.com> wrote: > - I expect tuples will also be worth specializing (complex sort keys are > often implemented as tuples). > > I'm not sure what you mean here... I'm looking at the types of lo.keys, > not of saved_ob_item

Re: [Python-ideas] Optimizing list.sort() by checking type in advance

2016-10-10 Thread Elliot Gorokhovsky
Oh no, the idea here is just you would copy over the floats associated with the PyObject* and keep them in an array of such structs, so that we know which PyObject* are associated with which floats. Then after the standard library quicksort sorts them you would copy the PyObject* into the list. So

Re: [Python-ideas] Optimizing list.sort() by checking type in advance

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 2:29 PM, Elliot Gorokhovsky wrote: > Ya, I think this may be a good approach for floats: if the list is all > floats, just copy all the floats into a seperate array, use the standard > library quicksort, and then construct a sorted PyObject*