Performance improvements in JVM parsing
masterEdamame includes significant performance optimizations for JVM users, making it up to 2.26x faster than standard sci options and 1.25x faster than clojure.core/read when parsing large files like core.clj.
Key optimizations include:
IndexingStringReader: A JVM-onlydeftypethat replaces the standardtools.readerstack. It uses.charAtand primitive mutable fields for line/column bookkeeping to avoid the overhead of genericRT.nthFromcalls and multiple reader layers.- Fast Paths: Optimized implementations for
readToken,readString, andskipWhitespacethat use substrings and primitive char loops instead ofStringBuilderor per-character protocol calls. - Reduced Allocation: The parser now uses integer locals instead of allocating a
Locrecord per form, and useswith-metawith direct associations instead ofvary-metawith closures. - Optimized Context: Hot keys in the
Optionsrecord are now declared as fields rather than living in an__extmaphash map, reducing record copying and map allocations.