malli
malli copied to clipboard
Add schema simplification / worker optimization
Schemas that contain choice need to backtrack when validation or coercion fail. As schemas get larger and more complicated, this can result in redundant work.
Proposed solution, using boolean algebra notation:
( A B ) + (A C) -> A (B +C)
This can be done trivially for validation, and with some care for transformation as well.
Users might want to trade off compile time for run time, so it should be configurable.
Also see: https://en.wikipedia.org/wiki/Quine%E2%80%93McCluskey_algorithm
See also: https://github.com/miikka/boolean-simplifier