[Python-Dev] Optimization of the Year

Hye-Shik Chang perky at i18n.org
Tue Feb 10 06:13:10 EST 2004


On Tue, Feb 10, 2004 at 02:15:39AM -0500, Raymond Hettinger wrote:
> Hey, hey!  After looking at this on and off for months, I finally
> found a safe way to dramatically improve the speed of building lists:
> 
> 	http://users.rcn.com/python/download/list.diff
> 

What a surprise! It accellated pystone speed from 17583 to 21022
on my machine!!  FYI, regrtests of python itself and several 3rd
party extension modules are passed also.

Great work! :)

> 
[snip]
> Please take a look and see if there are any holes in the theory.

Your explanation sounds reasonable to me. And the patch looks good.
(a minor cosmetics: unnecessary two semicolons on line 1876 ;)

> 
> While the patch passes the test suite, it is possible that some
> extension module reallocs() the list to a smaller size (leaving
> the pointer unchanged) and then changes its mind and starts growing
> the list again.  Given the magnitude of the speed-up, I think that
> risk is warranted.

Indeed.


Cheers,
Hye-Shik



More information about the Python-Dev mailing list