summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-03-18 20:06:12 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-03-18 20:06:12 (GMT)
commitbd7926478de92a2a0ef4440e1a9ae61b706a80d2 (patch)
treef92ef0133e96195e1875cc74b046474aeb7be155 /Doc
parente7f45b8e5948d7367c3754b0506b082d1296138f (diff)
downloadcpython-bd7926478de92a2a0ef4440e1a9ae61b706a80d2.zip
cpython-bd7926478de92a2a0ef4440e1a9ae61b706a80d2.tar.gz
cpython-bd7926478de92a2a0ef4440e1a9ae61b706a80d2.tar.bz2
Issue #4258: Make it possible to use 30-bit digits for PyLongs:
- new configure option --enable-big-digits - new structseq sys.int_info giving information about the internal format By default, 30-bit digits are enabled on 64-bit machines but disabled on 32-bit machines.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/sys.rst17
-rw-r--r--Doc/whatsnew/3.1.rst23
2 files changed, 40 insertions, 0 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index a00c516..091b4d6 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -413,6 +413,23 @@ always available.
same information.
+.. data:: int_info
+
+ A struct sequence that holds information about Python's
+ internal representation of integers. The attributes are read only.
+
+ +-------------------------+----------------------------------------------+
+ | attribute | explanation |
+ +=========================+==============================================+
+ | :const:`bits_per_digit` | number of bits held in each digit. Python |
+ | | integers are stored internally in base |
+ | | ``2**int_info.bits_per_digit`` |
+ +-------------------------+----------------------------------------------+
+ | :const:`sizeof_digit` | size in bytes of the C type used to |
+ | | represent a digit |
+ +-------------------------+----------------------------------------------+
+
+
.. function:: intern(string)
Enter *string* in the table of "interned" strings and return the interned string
diff --git a/Doc/whatsnew/3.1.rst b/Doc/whatsnew/3.1.rst
index 68a76f3..56e5869 100644
--- a/Doc/whatsnew/3.1.rst
+++ b/Doc/whatsnew/3.1.rst
@@ -87,5 +87,28 @@ Some smaller changes made to the core Python language are:
(Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.)
+* Integers are now stored internally either in base 2**15 or in base
+ 2**30, the base being determined at build time. Previously, they
+ were always stored in base 2**15. Using base 2**30 gives
+ significant performance improvements on 64-bit machines, but
+ benchmark results on 32-bit machines have been mixed. Therefore,
+ the default is to use base 2**30 on 64-bit machines and base 2**15
+ on 32-bit machines; on Unix, there's a new configure option
+ --enable-big-digits that can be used to override this default.
+
+ Apart from the performance improvements this change should be
+ invisible to end users, with one exception: for testing and
+ debugging purposes there's a new structseq ``sys.int_info`` that
+ provides information about the internal format, giving the number of
+ bits per digit and the size in bytes of the C type used to store
+ each digit::
+
+ >>> import sys
+ >>> sys.int_info
+ sys.int_info(bits_per_digit=30, sizeof_digit=4)
+
+
+ (Contributed by Mark Dickinson; :issue:`4258`.)
+
.. ======================================================================