[Patches] [ python-Patches-687598 ] array.append is sloooow
SourceForge.net
noreply@sourceforge.net
Mon, 24 Feb 2003 15:16:49 -0800
Patches item #687598, was opened at 2003-02-16 13:55
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=687598&group_id=5470
Category: Modules
Group: Python 2.3
Status: Closed
Resolution: Accepted
Priority: 7
Submitted By: logistix (logistix)
Assigned to: Neal Norwitz (nnorwitz)
Summary: array.append is sloooow
Initial Comment:
array.append re'mallocs and copies each time an item is
appended to it. That makes the code below grind to a
halt. I stole the resizing algorithm from listobject.c and
it speeds things up a bit.
Python 2.3a1 (#38, Feb 16 2003, 14:23:39) [MSC v.1300
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> import array
>>> a = array.array('i')
>>> for i in range(10000000):
... a.append(i)
...
----------------------------------------------------------------------
>Comment By: logistix (logistix)
Date: 2003-02-24 17:16
Message:
Logged In: YES
user_id=699438
I saw Tim's benchmarks on the commit mailing list. It's
consistent with what I get. BSD based machines also ran at
exponential time before the patch. Now I'm curious about
Mac OSX.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2003-02-23 20:24
Message:
Logged In: YES
user_id=33168
Checked in as: Modules/arraymodule.c 2.84
This improves perf by about 5.6% for me on Linux, but it may
help more on windows.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2003-02-23 08:16
Message:
Logged In: YES
user_id=6380
Good idea. Somebody please check the patch and then check it in.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=687598&group_id=5470