summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorSjoerd Mullender <sjoerd@acm.org>1993-10-15 16:18:48 (GMT)
committerSjoerd Mullender <sjoerd@acm.org>1993-10-15 16:18:48 (GMT)
commit842d2ccdcd540399501a918b9724d2eaf5599f39 (patch)
treea62399047b129d4fe4f5db57a925fa7f135cabd2 /Objects/object.c
parent21d335ed9ef6fbb16341809fe224b45a3f41243f (diff)
downloadcpython-842d2ccdcd540399501a918b9724d2eaf5599f39.zip
cpython-842d2ccdcd540399501a918b9724d2eaf5599f39.tar.gz
cpython-842d2ccdcd540399501a918b9724d2eaf5599f39.tar.bz2
intobject.c: Save references to small integers, so that they can be
shared. The default is to save references to the integers in the range -1..99. The lower limit can be set by defining NSMALLNEGINTS (absolute value of smallest integer to be saved) and NSMALLPOSINTS (1 more than the largest integer to be saved). tupleobject.c: Save a reference to the empty tuple to be returned whenever a tuple of size 0 is requested. Tuples of size 1 upto, but not including, MAXSAVESIZE (default 20) are put in free lists when deallocated. When MAXSAVESIZE equals 1, only share references to the empty tuple, when MAXSAVESIZE equals 0, don't include the code at all and revert to the old behavior. object.c: Print some more statistics when COUNT_ALLOCS is defined.
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/object.c b/Objects/object.c
index a20b24d..bc0aeed 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -36,15 +36,21 @@ long ref_total;
#ifdef COUNT_ALLOCS
static typeobject *type_list;
-
+extern int tuple_zero_allocs, fast_tuple_allocs;
+extern int quick_int_allocs, quick_neg_int_allocs;
void
dump_counts()
{
typeobject *tp;
for (tp = type_list; tp; tp = tp->tp_next)
- printf("%s %d %d %d\n", tp->tp_name, tp->tp_alloc, tp->tp_free,
+ printf("%s alloc'd: %d, freed: %d, max in use: %d\n",
+ tp->tp_name, tp->tp_alloc, tp->tp_free,
tp->tp_maxalloc);
+ printf("fast tuple allocs: %d, empty: %d\n", fast_tuple_allocs,
+ tuple_zero_allocs);
+ printf("fast int allocs: pos: %d, neg: %d\n", quick_int_allocs,
+ quick_neg_int_allocs);
}
void