[Python-Dev] Windows Low Fragementation Heap yields speedup of ~15%

Evan Jones ejones at uwaterloo.ca
Sat Feb 19 01:10:55 CET 2005

On Feb 18, 2005, at 17:51, Tim Peters wrote:
> grow the list to its final size once, at the start (overestimating if
> you don't know for sure).  Then instead of appending, keep an index to
> the next free slot, same as you'd do in C.  Then the list guts never
> move, so if that doesn't yield the same kind of speedup without using
> LFH, list copying wasn't actually the culprit to begin with.

If this *does* improve the performance of his application by 15%, that  
would strongly argue for an addition to the list API similar to Java's  
ArrayList.ensureCapacity or the STL's vector<T>::reserve. Since the  
list implementation already maintains separate ints for the list array  
size and the list occupied size, this would really just expose this  
implementation detail to Python. I don't like revealing the  
implementation in this fashion, but if it does make a significant  
performance difference, it could be worth it.


Evan Jones

More information about the Python-Dev mailing list