diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-08-21 21:53:09 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-08-21 21:53:09 +0100 |
commit | 85b83d7a203641639b440b6a164b4075e00e91a6 (patch) | |
tree | 27920124aa00e7c2e64190266692e8d1745d28d0 /symtable.c | |
parent | ed37f7cd80ce92a03ef3fccbbc3246addb29e2e1 (diff) | |
download | alisp-85b83d7a203641639b440b6a164b4075e00e91a6.tar.gz alisp-85b83d7a203641639b440b6a164b4075e00e91a6.tar.bz2 alisp-85b83d7a203641639b440b6a164b4075e00e91a6.zip |
Small optimisation: don't initialise a symbol table immediately on init
Why? This way, until we use symbols, the system doesn't generate the
table and thus grow the memory usage by a couple kb.
Diffstat (limited to 'symtable.c')
-rw-r--r-- | symtable.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -34,6 +34,10 @@ void sym_table_init(sym_table_t *table) char *sym_table_find(sym_table_t *table, sv_t sv) { + // Initialise the table if it's not done already + if (table->entries.capacity == 0) + sym_table_init(table); + // WIP: Deal with resizing this when table->count > table->size / 2 u64 index = djb2(sv) & (table->capacity - 1); |