Use gperf to save memory.

We check terms to see if they're in the wordlist, if they are we reuse
the string from the wordlist instead of allocating a new one.

(I've always wanted to use Gperf so I'm pretty stoked about this!)
This commit is contained in:
Simon Forman
2023-02-02 16:58:44 -08:00
parent 0a66f2b804
commit 4be1cc5767
5 changed files with 47 additions and 53 deletions
+3 -1
View File
@@ -9,6 +9,8 @@ GPERF_OPTS = --readonly-tables --enum --includes --global-table
joy: ${OBJS} $(STATIC_GCLIB)
keywords.c: KEYWORDS.txt
keywords.c: KEYWORDS.txt keywords.h
gperf --output-file=$@ --hash-function-name=keyword_hash $(GPERF_OPTS) KEYWORDS.txt
# keywords.c doesn't strictly depend on keywords.h, but I want make to
# remake if keywords.h is touched.