Skip to content

v1.13.0

Choose a tag to compare

@schungx schungx released this 16 Mar 23:04
· 1072 commits to main since this release
4d84401

This version attempts a number of optimizations that may yield small speed improvements:

  • Simple operators (e.g. integer arithmetic) are inlined to avoid the overhead of a function call.
  • The tokenizer uses pre-calculated tables (generated by GNU gperf) for keyword recognition.
  • A black-arts trick (see Engine::black_box) is used to prevent LLVM from optimizing hand-tuned AST node matches back into a lookup table, which messes up branch prediction on modern CPU's.

Bug fixes

  • Complex indexing/dotting chains now parse correctly, for example: a[b][c[d]].e
  • map and filter for arrays are marked pure. Warnings are added to the documentation of pure array methods that take this closures.
  • Syntax such as foo.bar::baz no longer panics, but returns a proper parse error.
  • Expressions such as !inside now parses correctly instead of as !in followed by side.
  • Custom syntax starting with symbols now works correctly and no longer raises a parse error.
  • Comparing different custom types now works correctly when the appropriate comparison operators are registered.
  • Some op-assignments, such as x += y where x and y are char, now work correctly instead of failing silently.
  • Op-assignments to bit flags or bit ranges now work correctly.

Potentially breaking changes

  • The trait method ModuleResolver::resolve_raw (which is a low-level API) now takes a &mut Scope parameter. This is a breaking change because the signature is modified, but this trait method has a default and is rarely called/implemented in practice.
  • Module::eval_ast_as_new_raw (a low-level API) now takes a &mut Scope instead of the Scope parameter. This is a breaking change because the &mut is now required.
  • Engine::allow_loop_expressions now correctly defaults to true (was erroneously false by default).

Enhancements

  • Engine::new_raw is now const and runs very fast, delaying all other initialization until first use.
  • The functions min and max are added for numbers.
  • Range cases in switch statements now also match floating-point and decimal values. In order to support this, however, small numeric ranges cases are no longer unrolled.
  • Loading a module via import now gives the module access to the current scope, including variables and constants defined inside.
  • Some very simple operator calls (e.g. integer add) are inlined to avoid the overhead of a function call, resulting in a small speed improvement.
  • The tokenizer now uses table-driven keyword recognizers generated by GNU gperf. At least theoretically it should be faster...
  • The field isAnonymous is added to JSON functions metadata.