[Python-3000] C API for ints and strings (original) (raw)
Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Sep 10 14:04:08 CEST 2007
- Previous message: [Python-3000] C API for ints and strings
- Next message: [Python-3000] C API for ints and strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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/
- Previous message: [Python-3000] C API for ints and strings
- Next message: [Python-3000] C API for ints and strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]