garbage collector and slowdown (guillaume weymeskirch)

skip at pobox.com skip at pobox.com
Sat Oct 4 15:35:00 CEST 2008


    guillaume> But I've noticed a near linear slowdown of the execution :
    guillaume> after a few minutes - and several millions of allocated and
    guillaume> freed objects, each iteration take more and more time to
    guillaume> execute.

I ran your script on my Mac and let it go for over an hour.  The times
printed near the end were not that different than the times near the start.

First few prints:

    4.80848908424
    4.17986106873
    4.07436394691
    4.57266497612
    4.26531600952
    4.1674759388
    4.00401592255
    4.56974005699
    4.33465600014
    4.17652106285
    4.02282094955
    4.6344628334

Last few prints:

    4.0330889225
    3.89743900299
    4.39918708801
    4.16099500656
    4.06551003456
    3.91927599907
    4.42701005936
    4.17856502533
    4.07650518417
    3.93242192268
    4.44240498543
    4.32765197754

Final summary:

    {'ClassicBig': 29580000, 'ClassicSmall': 29580000, 'Tree': 29580000}
    max=5.617558 min=3.869602

This was with Python 2.6.  I then ran it for awhile (though not nearly as
long - just 5-10 minutes) with Python 2.5.

First few prints:

    4.50398087502
    3.73511385918
    3.63765382767
    4.04779291153
    3.87206196785
    3.73774003983
    3.62571001053
    4.02851200104
    3.90740704536
    3.87872505188
    3.71122288704
    4.11415696144
    3.95573282242

Last few prints:

    5.18314695358
    5.6188788414
    5.40970396996
    5.31133294106
    5.14807605743
    5.70623922348
    5.47632288933
    5.46225881577
    5.42709779739
    5.80780506134
    5.53798508644
    5.43349313736
    5.5712749958
    5.91922187805

Summary:

    {'ClassicBig': 5101922, 'ClassicSmall': 5101922, 'Tree': 5101922}
    max=6.006355 min=3.625710 

It seems that whatever problem you saw in 2.5 is fixed in 2.6.

Skip



More information about the Python-list mailing list