[Python-3000] C API for ints and strings
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Mon Sep 10 14:04:08 CEST 2007
Dnia 09-09-2007, N o godzinie 21:27 -0400, Jim Jewett napisał(a):
> If python handled small ints itself, and only farmed out the "large"
> ones,
If GMP is used, it's definitely worth to have a non-GMP representation
for small integers, because GMP itself does not do it. A GMP integer
is represented by a pointer to digits, the allocated size, and the used
size multiplied by the sign; no special cases here.
(The fact that GMP does not do it is good for people who want to make
a super-compact representation themselves. GMP optimization for the same
case would be wasted. It requires some work for implementing overflow
detection, but it yields a very good final result.)
The major technical problem with GMP is that an out of memory condition
during computation is a fatal error, GMP does not provide a way to
recover from it.
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Python-3000
mailing list