Skip to content

v1.27.0

Latest

Choose a tag to compare

@yhirose yhirose released this 24 Oct 23:37
· 1 commit to master since this release

A parser can now be used from several threads at once. This release also speeds up dictionary lookups and adds regression tests and a ThreadSanitizer check to CI.

⚠️ Changes to be aware of

A parser can be used from several threads

  • Parses on different threads may share one peg::parser. The packrat statistics of the parses add up across the threads.
  • The callbacks set with set_logger, set_error_reporter and enable_trace are called one at a time, so they may keep state of their own.
  • The library does not protect your semantic actions. They run on the threads that parse, so state they share between parses needs its own synchronization.
  • Changing the parser while parses are running, such as its rules, options, callbacks or set_max_depth, is not safe. Set it up before the parses start.
  • Single-thread parsing is not slower. The instruction counts before and after the change are equal in our measurements.

ABI

Internal types changed, so the ABI check reports differences. Rebuild code that was compiled against an earlier version.

⚡ Performance

  • Dictionary words are looked up in a double-array trie.

🔧 Internals

  • The first use of two start rules at once no longer races on the rule numbers.
  • A parse keeps the rule settings it started with.

Tests and CI

  • Regression tests for parsing on several threads, and for the callbacks that are called one at a time.
  • The CI runs the whole test suite under ThreadSanitizer. A reported race fails the job.