[Python-3000] Python, int/long and GMP (original) (raw)

Victor Stinner victor.stinner at haypocalc.com
Fri Sep 28 18:58:29 CEST 2007


On Friday 28 September 2007 18:44:43 you wrote:

> GMP doesn't have a concept of a non-complex structure. It always > allocates memory. (...)

I don't know GMP internals. I thaught that GMP uses an hack for small integers.

> Also, removing python's caching of integers < 100 as you did in this_ _> patch is surely a huge killer of performance.

Oh yes, I removed the cache because I would like to quickly get a working Python version. It took me two weeks to write the patch. It's not easy to get into CPython source code! And integer is one of the most important type!

I can vouch for that. Allocation can easily dominate performance. It invalidates the rest of the benchmark.

I may also use Python garbage collector for GMP memory allocations since GMP allows to use my own memory allocating functions.

GMP also has its own reference counter mechanism :-/

Victor

Victor Stinner aka haypo http://www.haypocalc.com/blog/



More information about the Python-3000 mailing list