On Thu, May 02, 2019 at 03:49:08PM +0200, [email protected] wrote: > > A few minor remaining questions: > > > > - What should the (initial) size of the keyword table be? > > You seem to have selected 999, I think that's fine, it could probably > even be half the size, as the number of distinct symbols usually > is not that high. > > > - Should we use "symbols" in CHICKEN_initialize to determine the > > keyword table size as well? > > One could do that, for example by using 1/3 or 1/4 of the symbol > table size.
Attached is a patch to make this so. Cheers, Peter
From 969c0f4dd587edd9f76215461e9b63ec890b4d05 Mon Sep 17 00:00:00 2001 From: Peter Bex <[email protected]> Date: Thu, 2 May 2019 19:06:51 +0200 Subject: [PATCH] Reduce default keyword table size, use symbol table size as a basis when given --- manual/Embedding | 11 ++++++----- runtime.c | 5 ++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manual/Embedding b/manual/Embedding index d6cd42cc..a4a5f319 100644 --- a/manual/Embedding +++ b/manual/Embedding @@ -26,12 +26,13 @@ only if this function has been called by the containing application. [C function] int CHICKEN_initialize (int heap, int stack, int symbols, void *toplevel) -Initializes the Scheme execution context and memory. {{heap}} -holds the number of bytes that are to be allocated for the secondary +Initializes the Scheme execution context and memory. {{heap}} holds +the number of bytes that are to be allocated for the secondary heap. {{stack}} holds the number of bytes for the primary -heap. {{symbols}} contains the size of the symbol table. Passing -{{0}} to one or more of these parameters will select a default -size. +heap. {{symbols}} contains the size of the symbol table. The keyword +table will be 1/4th the symbol table size. Passing {{0}} to one or +more of these parameters will select a default size. + {{toplevel}} should be a pointer to the toplevel entry point procedure. You should pass {{C_toplevel}} here. In any subsequent call to {{CHICKEN_run}} you can simply diff --git a/runtime.c b/runtime.c index 842f8645..5638df55 100644 --- a/runtime.c +++ b/runtime.c @@ -155,7 +155,7 @@ static C_TLS int timezone; #endif #define DEFAULT_SYMBOL_TABLE_SIZE 2999 -#define DEFAULT_KEYWORD_TABLE_SIZE 999 +#define DEFAULT_KEYWORD_TABLE_SIZE 499 #define DEFAULT_HEAP_SIZE DEFAULT_STACK_SIZE #define MINIMAL_HEAP_SIZE DEFAULT_STACK_SIZE #define DEFAULT_SCRATCH_SPACE_SIZE 256 @@ -716,8 +716,7 @@ int CHICKEN_initialize(int heap, int stack, int symbols, void *toplevel) if(symbol_table == NULL) return 0; - /* TODO: Should we use "symbols" here too? */ - keyword_table = C_new_symbol_table("kw", DEFAULT_KEYWORD_TABLE_SIZE); + keyword_table = C_new_symbol_table("kw", symbols ? symbols / 4 : DEFAULT_KEYWORD_TABLE_SIZE); if(keyword_table == NULL) return 0; -- 2.11.0
signature.asc
Description: PGP signature
_______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
