Skip to content

Releases: boxbeam/Crunch

Shallow cloning for CompiledExpression

05 Feb 16:56
Compare
Choose a tag to compare

CompiledExpression effectively just wraps a Value and handles caching the variableValues array to minimize allocations. This makes it thread-unsafe, but in the previous update, the entire expression tree is now decoupled from the CompiledExpression since variable values are passed through an array function parameter rather than having Variable objects store a reference to the expression they belong to. This means that clone() can now reuse the same Value instance, effectively only cloning the wrapper that caches the array.

The benefit of this is that it is now O(1) to clone a CompiledExpression, whereas before it would take longer the larger the expression is, and require far more allocations. It should be virtually free to multithread with Crunch now.

Make variables no longer reference the expression they belong to

05 Feb 00:54
Compare
Choose a tag to compare

Fixes a bug affecting cloned expressions that have variables, wherein the variables would still refer to the old expression

Allow ExpressionEnv methods to be used builder-style

02 Feb 22:31
Compare
Choose a tag to compare

Also includes some refactoring courtesy of @IllusionTheDev

2.0 - Parser rewrite

07 Oct 03:51
Compare
Choose a tag to compare

A bug was reported by Discord user ErikH which I couldn't find the cause of, due to the old parser code being practically unreadable. I've rewritten the parser entirely, and the code is now much cleaner, along with several improvements and one breaking change.

Breaking changes

Implicit multiplication is no longer supported

Changes

  • Parser performance improved by 15%
  • Fixed bug causing expression max( 0.0, (378044 * 100 / 100.0 - 294964) * 1.0 ) - 0.0 to not be parsable
  • Improved error messages display where in the input an error happened by visually pointing it out:
    image
  • Updated benchmarks written with jmh now available at https://github.com/Redempt/CrunchBenchmark, results in readme
  • Repeating unary operators no longer breaks the parser (!!true, --1)

Fix inlining of rand function

16 Feb 23:03
Compare
Choose a tag to compare

The rand operator was able to be inlined if it was used on a constant, resulting in the same value being produced every time the expression is evaluated. This no longer happens.

Add != operator, adjust priority of boolean operators

13 Feb 02:10
Compare
Choose a tag to compare
  • Should improve clarity of boolean expressions and make them easier to write

Add TokenType for lazy variables

04 Feb 16:51
Compare
Choose a tag to compare

Fixes issue which would cause lazy variables to be collapsed into literal values

Add support for lazy variables

02 Feb 04:53
Compare
Choose a tag to compare
  • Lazy variables do not need to be passed with the other variable values
  • Defined with a name and lambda, and evaluated lazily when the expression is run
  • Good for when you have values that might be used, but might not and are computationally expensive to recalculate each step

1.0

18 Dec 21:34
Compare
Choose a tag to compare
1.0
Migrate to custom build server