From 4fe91fbeb4aa86ac43e530621220d46c8c03bffc Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 3 Apr 2012 18:54:59 -0700 Subject: Performance tweaking and fixes. * gc.c (BACKPTR_VEC_SIZE): Increase greatly, so that we don't trigger gc due to overflow of the backptr array. This is not likely to yield a lot of free objects except in a full GC. (FULL_GC_INTERVAL): From 10 to 20. (gc): Take a not of whether or not gc was entered with free_list being exhausted or not. Call more() only if the free_list was empty, and a full sweep was done. Reset partial_gc_count only when a full gc is triggered. --- ChangeLog | 13 +++++++++++++ gc.c | 11 +++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4441ad2f..0f4c3cce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2012-04-03 Kaz Kylheku + + Performance tweaking and fixes. + + * gc.c (BACKPTR_VEC_SIZE): Increase greatly, so that we don't + trigger gc due to overflow of the backptr array. This is not likely + to yield a lot of free objects except in a full GC. + (FULL_GC_INTERVAL): From 10 to 20. + (gc): Take a not of whether or not gc was entered with free_list + being exhausted or not. Call more() only if the free_list was + empty, and a full sweep was done. + Reset partial_gc_count only when a full gc is triggered. + 2012-04-03 Kaz Kylheku Fix failing test case tests/006/freeform-1.txr. diff --git a/gc.c b/gc.c index 3433fa78..06d74473 100644 --- a/gc.c +++ b/gc.c @@ -44,8 +44,8 @@ #define PROT_STACK_SIZE 1024 #define HEAP_SIZE 16384 -#define BACKPTR_VEC_SIZE 4096 -#define FULL_GC_INTERVAL 10 +#define BACKPTR_VEC_SIZE (2 * HEAP_SIZE) +#define FULL_GC_INTERVAL 20 #define FRESHQ_SIZE (2 * HEAP_SIZE) typedef struct heap { @@ -539,11 +539,14 @@ void gc(void) val gc_stack_top = nil; if (gc_enabled) { + int free_list_empty = free_list != nil; + #if CONFIG_GEN_GC if (backptr_idx && (++partial_gc_count == FULL_GC_INTERVAL || backptr_oflow)) { full = 1; + partial_gc_count = 0; } else { full = 0; } @@ -554,11 +557,11 @@ void gc(void) gc_enabled = 0; mark(&mc, &gc_stack_top); hash_process_weak(); - if ((sweep() < 3 * HEAP_SIZE / 4) && (full || !opt_gc_debug)) + if ((sweep() < 3 * HEAP_SIZE / 4) + && full && free_list_empty) more(); gc_enabled = 1; #if CONFIG_GEN_GC - partial_gc_count = 0; backptr_idx = 0; backptr_oflow = 0; freshq_head = freshq_tail = 0; -- cgit v1.2.3