diff options
author | Sjoerd Mullender <sjoerd@acm.org> | 1993-10-15 16:18:48 +0000 |
---|---|---|
committer | Sjoerd Mullender <sjoerd@acm.org> | 1993-10-15 16:18:48 +0000 |
commit | 88628f0b45e24a809db2b54136d97d493c931982 (patch) | |
tree | ed19b154498994aedddc21f81f6ffc5537e2b6bb /Objects/object.c | |
parent | 75e95d195fb79b5cdff2c589052b8e5dad4514d7 (diff) | |
download | cpython-88628f0b45e24a809db2b54136d97d493c931982.tar.gz |
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.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/object.c b/Objects/object.c index a20b24d958..bc0aeed295 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 |