Skip to content

v1.12.0

Latest

Choose a tag to compare

@yhirose yhirose released this 10 Jun 03:48

Performance

Faster packrat parsing with an open-addressing memoization cache

  • Replaced the packrat memoization cache (previously a std::map) with PackratCache: a flat open-addressing hash table with linear probing, fused (position * rule_count + rule_id) keys, a lazily allocated semantic-value array, and an input-length-based initial capacity that all but eliminates rehashing.
  • Cache the tracer-availability check as a bool computed once at parse start, instead of re-deriving it on every operator visit.
  • Replaced the per-byte locale tolower with a lookup table frozen at parse start, used by both literal matching and the keyword guard.
  • Switched the semantic value stack to unique_ptr.

These changes cut big.sql parse time from 3.4x → 2.0x relative to the YACC (libpg_query) baseline. The same optimizations were ported to rust-peglib, yielding ~17% faster TPC-H queries.

Bug Fixes

Fix MiniJsTest being skipped when run from non-standard directories (#341)

  • find_grammar() only searched spec/mini-js/grammar.peg with the relative prefixes "", "../", and "../../" from the current working directory. When the test binary ran from a directory that was not 0–2 levels below the repo root (e.g. nested build trees or package builds such as FreeBSD ports), the grammar file was not found, SetUpTestSuite() threw, and GoogleTest reported all 70 MiniJsTest cases as Skipped.
  • The absolute grammar path is now passed via the MINI_JS_GRAMMAR_PATH compile definition and used as the primary candidate, falling back to the existing relative search.

Full Changelog: v1.11.0...v1.12.0