[Python-checkins] python/dist/src/Objects dictobject.c, 2.153, 2.154

Skip Montanaro skip at pobox.com
Wed Mar 17 17:29:41 EST 2004


    raymond> * Added a freelist scheme styled after that for tuples.  Saves
    raymond>   around 80% of the calls to malloc and free.  About 10% of the
    raymond>   time, the previous dictionary was completely empty; in those
    raymond>   cases, the dictionary initialization with memset() can be
    raymond>   skipped.

% timeit.py 'd = {} ; d = {"a": 1}'
1000000 loops, best of 3: 1.66 usec per loop
... cvs up ...
... make ...
% ./python.exe ~/local/bin/timeit.py 'd = {} ; d = {"a": 1}'
1000000 loops, best of 3: 1.23 usec per loop

Cool.

Skip



More information about the Python-checkins mailing list