map del efficiency python2.2 and 2.1

Andrew McNamara andrewm at object-craft.com.au
Wed Jul 17 01:54:57 EDT 2002


>Under current CVS Python (what will eventually be Python 2.3), pymalloc is
>tuned properly for new-style classes, and the deletion times are minor on my
>home Win98SE 866MHz box (the del times below are 100x smaller than you were
>seeing with 221+pymalloc); they should become minor on your box too, as
>pymalloc's code is the same on all platforms, while its few hardcoded
>assumptions about OS paging are geared more toward Unix than Windows:

That's what I wanted to hear! I had just finished reading your CVS
check-in comments and was building and testing the CVS python. Thanks
for the fine work.

>because it just confuses things to time explicit gc.collect() calls too
>(except when you're specifically trying to time collection, as you may have
>intended to do in your " del" test).  

I thought it only fair that explicit GC be included in the earlier tests
as well - as it is when autoGC is enabled.

BTW, I always ran the tests one at a time (with only one "if" selected)
- running more than one test at a time resulted in wildly fluctuating
times - presumably due to fragmentation of the heap.

>gc is a bit zippier in current CVS too.

More good news. Thanks. 8-)

Here's the table again with CVS Python included, for those that care:

               Create and       
                 set attr   Set attr     Del+GC       RSS
                 --------   --------   --------   -------
py22  slots         20.3s       4.6s      19.5s       48M
py221 slots         21.0s       5.0s      21.5s       48M
pymalloc slots      16.2s       4.7s       0.7s       40M
pyCVS slots         17.8s       5.0s       0.8s       40M

py22  obj           65.9s       7.4s     401.5s      185M
py221 obj           62.1s       7.3s     492.8s      185M
pymalloc obj        57.9s       7.2s     125.8s      185M
pyCVS obj           50.6s       6.8s       1.5s      185M

py22  trad          55.8s       6.8s     275.8s      192M
py221 trad          56.8s       7.1s     284.7s      192M
pymalloc trad       52.6s       6.8s     115.0s      185M
pyCVS trad          44.2s       6.2s       1.3s      185M

py211 trad          52.6s       6.6s     239.4s      154M

With gc.disable(), and explicitly calling gc.collect():

               Create and       
                 set attr   Set attr     Del+GC       RSS
                 --------   --------   --------   -------
py22  slots         13.6s       4.6s      19.7s       48M
py221 slots         14.0s       5.0s      19.4s       48M
pymalloc slots      10.6s       4.7s       0.7s       40M
pyCVS slots         17.8s       5.0s       0.8s       44M

py22  obj           18.0s       7.3s     400.5s      185M
py221 obj           18.7s       7.6s     399.0s      185M
pymalloc obj        16.2s       7.2s     117.0s      185M
pyCVS obj           13.8s       6.8s       1.5s      185M

py22  trad          11.2s       6.8s     270.8s      192M
py221 trad          12.1s       7.2s     240.7s      192M
pymalloc trad       11.4s       6.8s     115.3s      185M
pyCVS trad           9.2s       6.3s       1.3s      185M

py211 trad          11.6s       6.5s     229.0s      154M

py152 trad           7.8s       3.1s      75.5s      123M


KEY
------   -----------------------------------------------------------
slots    with new-style objects and using slots
obj      with new-style objects
trad     with traditional objects
pyCVS    Python CVS (aka 2.3, pymalloc on by default)
pymalloc Python 2.2.1 compiled with --with-pymalloc
py221    Python 2.2.1
py22     Python 2.2
py211    Python 2.1.1 with traditional objects
py152    Python 1.5.2 with traditional objects (no cyclic-GC)


-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/





More information about the Python-list mailing list