Hi,
I recall Araq mentioned Nim compiler rewrites string case statements into hash jump table for efficiency. Does anyone knows where is the code in compiler's codebase that does that.
Thank you
$NIM_SRC_DIR/compiler/ccgexprs.nim
inside proc genStringCaseThanks Parashurama,
Found genStringCase in ccgstmts.nim, but your hint was useful
I'm working on a similar problem. The performance for parsing/stringifying enums with holes is abysmal (in C anyway, JS is mostly fine).
The problem is getting acceptable performance without importing the tables module which is kinda huge, needs modules math, hashes and others.
I tried various implementation of parseEnum and I'm settling with a variant of binary search with a lookup table. (it's within ~10-20% of hashtable for Enums with ~8000 entries)
Another factor is code length, basic linear search is very short but performan badly on Enums with ~100+ entries.
PR is coming once I cleanup the code.