[Python-checkins] python/dist/src/Modules arraymodule.c,2.83,2.84
Neal Norwitz
neal@metaslash.com
Mon, 24 Feb 2003 08:56:08 -0500
On Mon, Feb 24, 2003 at 07:38:01AM -0500, Guido van Rossum wrote:
> > This improves speed by about 5.6% for me.
["This" refers to adding roundupsize() to bump up
the size of an array by increasing large multiples
(same as a list).]
> I don't understand this comment. If the fix works, it should change
> quadratic time to something vaguely N-log-N-ish, which cannot be
> expressed as a percentage without knowing N.
By adding roundupsize(), the difference was calling PyMem_RESIZE()
fewer times and also doing a memmove less. I was surprised at
how little benefit there was, that was why I added the comment.
I would like to know if this affects other platforms more.
I noticed the original problem was on windows.
With 10,000,000 elements, I tested before and after the patch:
before= 42.5821830034 seconds
after= 40.1672360897 seconds
I'm not sure what the deal is. The code looks like it is the same as
in listobject, except that array uses a memmove while list uses a for
loop. Can someone test on windows to see if the timing is drastically
improved? Maybe it's just a realloc issue?
Neal