Measuring and attempting to improve performance

This commit is contained in:
Justin Ethier 2015-10-23 22:13:11 -04:00
parent 7a45137ca2
commit 31a2b276b3
3 changed files with 9 additions and 3 deletions

5
gc.c
View file

@ -48,7 +48,8 @@ int gc_grow_heap(gc_heap *h, size_t size, size_t chunk_size)
size_t cur_size, new_size;
gc_heap *h_last = gc_heap_last(h);
cur_size = h_last->size;
new_size = gc_heap_align(((cur_size > size) ? cur_size : size) * 2);
// JAE - For now, just add a new page
new_size = cur_size; //gc_heap_align(((cur_size > size) ? cur_size : size) * 2);
h_last->next = gc_heap_create(new_size, h_last->max_size, chunk_size);
return (h_last->next != NULL);
}
@ -71,7 +72,7 @@ void *gc_try_alloc(gc_heap *h, size_t size)
f1->next = f2->next;
}
// zero-out the header
memset((object)f2, 0, sizeof(gc_header_type));
//memset((object)f2, 0, sizeof(gc_header_type));
return f2;
}
}

View file

@ -94,7 +94,7 @@ void gc_thr_add_to_move_buffer(gc_thread_data *d, int *alloci, object obj);
#define STACK_GROWS_DOWNWARD 1
/* Size of the stack buffer, in bytes. */
#define STACK_SIZE 100000
#define STACK_SIZE 500000
/* Size of the 2nd generation, in bytes. */
#define HEAP_SIZE 6000000

View file

@ -10,6 +10,7 @@
#include "cyclone/runtime.h"
//int JAE_DEBUG = 0;
int gcMoveCountsDEBUG[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
/* Error checking section - type mismatch, num args, etc */
/* Type names to use for error messages */
@ -2382,6 +2383,8 @@ size_t gc_collect(gc_heap *h, size_t *sum_freed)
char *gc_move(char *obj, gc_thread_data *thd, int *alloci, int *heap_grown) {
if (!is_object_type(obj)) return obj;
gcMoveCountsDEBUG[type_of(obj)]++;
//printf("DEBUG gc_move type = %ld\n", type_of(obj)); // JAE DEBUG
switch(type_of(obj)){
case cons_tag: {
@ -2723,6 +2726,8 @@ fprintf(stdout, "DEBUG, starting major mark/sweep GC\n"); // JAE DEBUG
printf("done, freed = %d, max_freed = %d, elapsed = %ld\n", freed, max_freed, time(NULL) - majorStart);
//JAE_DEBUG++;
//if (JAE_DEBUG == 2) exit(1); // JAE DEBUG
for (i = 0; i < 20; i++){
printf("gcMoveCountsDEBUG[%d] = %d\n", i, gcMoveCountsDEBUG[i]);}
}
//fprintf(stdout, "DEBUG, finished minor GC\n"); // JAE DEBUG