This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients lukasz.langa, mark.dickinson, pitrou, rhettinger, scoder, serhiy.storchaka
Date 2015-05-01.14:02:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1430488941.32.0.124414957859.issue24076@psf.upfronthosting.co.za>
In-reply-to
Content
I tried implementing a freelist. Patch attached, mostly adapted from the one in dictobject.c, but certainly needs a bit of cleanup.

The results are not bad, about 10-20% faster:

Original:

$ ./python -m timeit 'sum(range(1, 100000))'
1000 loops, best of 3: 1.86 msec per loop

$ ./python -m timeit -s 'l = list(range(1000, 10000))' '[(i*2+5) // 7 for i in l]'
1000 loops, best of 3: 1.05 msec per loop


With freelist:

$ ./python -m timeit 'sum(range(1, 100000))'
1000 loops, best of 3: 1.52 msec per loop

$ ./python -m timeit -s 'l = list(range(1000, 10000))' '[(i*2+5) // 7 for i in l]'
1000 loops, best of 3: 931 usec per loop
History
Date User Action Args
2015-05-01 14:02:21scodersetrecipients: + scoder, rhettinger, mark.dickinson, pitrou, lukasz.langa, serhiy.storchaka
2015-05-01 14:02:21scodersetmessageid: <1430488941.32.0.124414957859.issue24076@psf.upfronthosting.co.za>
2015-05-01 14:02:21scoderlinkissue24076 messages
2015-05-01 14:02:20scodercreate