summaryrefslogtreecommitdiff
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-06-27 18:19:09 +0000
committerMark Dickinson <dickinsm@gmail.com>2010-06-27 18:19:09 +0000
commit85cc0e002b7a4b396648d2b95639079feed28872 (patch)
treea1bb24e55e6c2261db8edfa0956a53d0e5528a5c /Objects/floatobject.c
parentde10382a7c4eb69fa7b6270ced5e74d353695f50 (diff)
downloadcpython-85cc0e002b7a4b396648d2b95639079feed28872.tar.gz
Issue #9089: Remove references to intobject.c and intobject.h from comments.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 9f94003184..a2c281eaf8 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -21,7 +21,22 @@
extern int finite(double);
#endif
-/* Special free list -- see comments for same code in intobject.c. */
+/* Special free list
+
+ Since some Python programs can spend much of their time allocating
+ and deallocating floats, these operations should be very fast.
+ Therefore we use a dedicated allocation scheme with a much lower
+ overhead (in space and time) than straight malloc(): a simple
+ dedicated free list, filled when necessary with memory from malloc().
+
+ block_list is a singly-linked list of all PyFloatBlocks ever allocated,
+ linked via their next members. PyFloatBlocks are never returned to the
+ system before shutdown (PyFloat_Fini).
+
+ free_list is a singly-linked list of available PyFloatObjects, linked
+ via abuse of their ob_type members.
+*/
+
#define BLOCK_SIZE 1000 /* 1K less typical malloc overhead */
#define BHEAD_SIZE 8 /* Enough for a 64-bit pointer */
#define N_FLOATOBJECTS ((BLOCK_SIZE - BHEAD_SIZE) / sizeof(PyFloatObject))