Re: how not use memmove when insert a object in the list

2006-04-30 Thread John Machin
On 30/04/2006 11:57 AM, kyo guan wrote: > Hi : > > python list object like a stl vector, if insert a object in the front > or the middle of it, > all the object after the insert point need to move backward. > > look at this code ( in python 2.4.3) > > for (i = n; --i >= where; )

Re: how not use memmove when insert a object in the list

2006-04-30 Thread Fredrik Lundh
"kyo guan" wrote: > for (i = n; --i >= where; ) /// here, why not use memmove? it would be more > speed then this loop. >items[i+1] = items[i]; have you benchmarked this on a wide variety of platforms, or are you just guessing? -- http://mail.python.org/mailman/listinfo/python-list

how not use memmove when insert a object in the list

2006-04-29 Thread kyo guan
Hi : python list object like a stl vector, if insert a object in the front or the middle of it, all the object after the insert point need to move backward. look at this code ( in python 2.4.3) static int ins1(PyListObject *self, int where, PyObject *v) { int i, n = self->ob_siz