Patches item #1605020, was opened at 2006-11-28 21:49 Message generated for change (Comment added) made by mklaas You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1605020&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core (C code) Group: Python 2.6 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mike Klaas (mklaas) Assigned to: Nobody/Anonymous (nobody) Summary: Performance boost for array repeat Initial Comment: Copy in exponentially-increasing sized chunks when performing array repeat. This enables fast initialization of large arrays. Performance is about an order of magnitude increase for single-element arrays, and about two orders of magnitude faster for single-element character arrays (see comments) ---------------------------------------------------------------------- >Comment By: Mike Klaas (mklaas) Date: 2006-11-28 21:54 Message: Logged In: YES user_id=1611720 Originator: YES Benchmarks on slightly-contended machine; before & after [ python-trunk]$ python -m timeit -s "from array import array" "array('c', '\0')*100000" 100 loops, best of 3: 4 msec per loop [ python-trunk]$ ./python -m timeit -s "from array import array" "array('c', '\0')*100000" 100000 loops, best of 3: 14.5 usec per loop [ python-trunk]$ python -m timeit -s "from array import array" "array('i', [0])*100000" 100 loops, best of 3: 3.42 msec per loop [ python-trunk]$ ./python -m timeit -s "from array import array" "array('i', [0])*100000" 1000 loops, best of 3: 517 usec per loop [ python-trunk]$ python -m timeit -s "from array import array" "array('i', [0,1,2,3])*100000" 100 loops, best of 3: 4.95 msec per loop [ python-trunk]$ ./python -m timeit -s "from array import array" "array('i', [0,1,2,3])*100000" 100 loops, best of 3: 2.55 msec per loop [ python-trunk]$ python -m timeit -s "from array import array" "array('c', '\0'*100)*1000" 10000 loops, best of 3: 46.6 usec per loop [ python-trunk]$ ./python -m timeit -s "from array import array" "array('c', '\0'*100)*1000" 100000 loops, best of 3: 19.6 usec per loop [ python-trunk]$ python -m timeit -s "from array import array" "array('c', '\0'*1000)*100" 10000 loops, best of 3: 22.8 usec per loop [ python-trunk]$ ./python -m timeit -s "from array import array" "array('c', '\0'*1000)*100" 10000 loops, best of 3: 20.7 usec per loop ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1605020&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches