Message242310
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 |
|
Date |
User |
Action |
Args |
2015-05-01 14:02:21 | scoder | set | recipients:
+ scoder, rhettinger, mark.dickinson, pitrou, lukasz.langa, serhiy.storchaka |
2015-05-01 14:02:21 | scoder | set | messageid: <1430488941.32.0.124414957859.issue24076@psf.upfronthosting.co.za> |
2015-05-01 14:02:21 | scoder | link | issue24076 messages |
2015-05-01 14:02:20 | scoder | create | |
|