aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2017-01-31 17:45:57 +0000
committerJustus Winter <[email protected]>2017-01-31 17:49:27 +0000
commit1c99db04ed62d395c1c88171ef147a580e0bb4ab (patch)
treef212acaa7dd5140401ff75b1cba54c1175598c07
parentgpgscm: Optimize environment lookups and insertions. (diff)
downloadlibgpg-error-1c99db04ed62d395c1c88171ef147a580e0bb4ab.tar.gz
libgpg-error-1c99db04ed62d395c1c88171ef147a580e0bb4ab.zip
gpgscm: Tune the hash tables.
* tests/gpgscm/scheme.c (oblist_initial_value): Increase the size of the hash table based on the number of symbols used after initializing the interpreter. (new_frame_in_env): Increase the size of the hash table based on the number of variables in the global environement. Signed-off-by: Justus Winter <[email protected]>
-rw-r--r--scheme.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/scheme.c b/scheme.c
index c4af94d..1265c62 100644
--- a/scheme.c
+++ b/scheme.c
@@ -1073,7 +1073,9 @@ static int hash_fn(const char *key, int table_size);
static pointer oblist_initial_value(scheme *sc)
{
- return mk_vector(sc, 461); /* probably should be bigger */
+ /* There are about 768 symbols used after loading the
+ * interpreter. */
+ return mk_vector(sc, 1009);
}
/* Add a new symbol NAME at SLOT. SLOT must be obtained using
@@ -2642,9 +2644,9 @@ static void new_frame_in_env(scheme *sc, pointer old_env)
{
pointer new_frame;
- /* The interaction-environment has about 300 variables in it. */
+ /* The interaction-environment has about 480 variables in it. */
if (old_env == sc->NIL) {
- new_frame = mk_vector(sc, 461);
+ new_frame = mk_vector(sc, 751);
} else {
new_frame = sc->NIL;
}