diff options
author | Keith Packard <keithp@keithp.com> | 2016-11-16 13:19:20 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-02-20 11:16:51 -0800 |
commit | daa06c8dedc6dc1cf21936ee2769d9d25f0567bd (patch) | |
tree | c8742f0c59d886d4540a6de17b0ab471c77f136b /src/test | |
parent | c8f9db184cc929ebde845730a6d4b7864e423a84 (diff) |
altos/lisp: Optimize chunk searching in collect
Note range of existing chunks to exclude objects outside.
Only look at chunks which have been set to reduce loop cost.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/ao_lisp_test.c | 24 | ||||
-rw-r--r-- | src/test/hanoi.lisp | 11 |
2 files changed, 34 insertions, 1 deletions
diff --git a/src/test/ao_lisp_test.c b/src/test/ao_lisp_test.c index 720355d2..68e3a202 100644 --- a/src/test/ao_lisp_test.c +++ b/src/test/ao_lisp_test.c @@ -101,10 +101,34 @@ main (int argc, char **argv) ao_lisp_file = NULL; } ao_lisp_read_eval_print(); + printf ("collects: full: %d incremental %d\n", ao_lisp_collects[AO_LISP_COLLECT_FULL], ao_lisp_collects[AO_LISP_COLLECT_INCREMENTAL]); + printf ("freed: full %d incremental %d\n", ao_lisp_freed[AO_LISP_COLLECT_FULL], ao_lisp_freed[AO_LISP_COLLECT_INCREMENTAL]); + + printf("loops: full %d incremental %d\n", + ao_lisp_loops[AO_LISP_COLLECT_FULL], + ao_lisp_loops[AO_LISP_COLLECT_INCREMENTAL]); + + printf("loops per collect: full %f incremental %f\n", + (double) ao_lisp_loops[AO_LISP_COLLECT_FULL] / + (double) ao_lisp_collects[AO_LISP_COLLECT_FULL], + (double) ao_lisp_loops[AO_LISP_COLLECT_INCREMENTAL] / + (double) ao_lisp_collects[AO_LISP_COLLECT_INCREMENTAL]); + + printf("freed per collect: full %f incremental %f\n", + (double) ao_lisp_freed[AO_LISP_COLLECT_FULL] / + (double) ao_lisp_collects[AO_LISP_COLLECT_FULL], + (double) ao_lisp_freed[AO_LISP_COLLECT_INCREMENTAL] / + (double) ao_lisp_collects[AO_LISP_COLLECT_INCREMENTAL]); + + printf("freed per loop: full %f incremental %f\n", + (double) ao_lisp_freed[AO_LISP_COLLECT_FULL] / + (double) ao_lisp_loops[AO_LISP_COLLECT_FULL], + (double) ao_lisp_freed[AO_LISP_COLLECT_INCREMENTAL] / + (double) ao_lisp_loops[AO_LISP_COLLECT_INCREMENTAL]); } diff --git a/src/test/hanoi.lisp b/src/test/hanoi.lisp index 387e696a..7a25656c 100644 --- a/src/test/hanoi.lisp +++ b/src/test/hanoi.lisp @@ -126,7 +126,7 @@ (setq stacks (replace stacks from from-stack)) (setq stacks (replace stacks to to-stack)) (display) - (delay 100) +; (delay 100) ) ) @@ -158,3 +158,12 @@ (clear) (_hanoi len 0 1 2) ) + +(defun hanois(n) + (while (> n 0) + (progn + (hanoi) + (setq l (1- l)) + ) + ) + ) |