parsley-core 1.2.0.0 → 1.2.0.1
raw patch · 3 files changed
+13/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
ChangeLog.md view
@@ -26,7 +26,11 @@ * Return continuations are also static functions, reducing beta-reduction required by GHC, `halt` generates better code * Recursive calls are also static functions, removing a lot of junk with the conversion from iterators to recursion * Registers are now bound once for recursive parsers, which close over their free-registers-* Strictness has been updated to reflect the reduced burden on GHC to optimise: now strictness is for performance, and +* Strictness has been updated to reflect the reduced burden on GHC to optimise: now strictness is for performance, and not to coax GHC to optimise at the cost of performance * Removed the "bad" binding for `Sat`, handlers are always bound on creation, so the binding is basically meaningless * Performance on 8.10+ is anywhere from 10-20% faster than 1.1.0.0++## 1.2.0.1 -- 2021-07-03++* Added Jump-Elision optimisation to the code generator.
parsley-core.cabal view
@@ -5,7 +5,7 @@ -- | +------- breaking internal API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 1.2.0.0+version: 1.2.0.1 synopsis: A fast parser combinator library backed by Typed Template Haskell description: This package contains the internals of the @parsley@ package. .
src/ghc/Parsley/Internal/Backend/CodeGenerator.hs view
@@ -173,11 +173,15 @@ makeΦ :: Fix4 (Instr o) (x ': xs) (Succ n) r a -> CodeGenStack (Fix4 (Instr o) xs (Succ n) r a -> Fix4 (Instr o) xs (Succ n) r a, Fix4 (Instr o) (x : xs) (Succ n) r a) makeΦ m | elidable m = return $! (id, m) where+ elidable :: Fix4 (Instr o) (x ': xs) (Succ n) r a -> Bool -- This is double-φ optimisation: If a φ-node points shallowly to another φ-node, then it can be elided- elidable (In4 (Join _)) = True+ elidable (In4 (Join _)) = True -- This is terminal-φ optimisation: If a φ-node points shallowly to a terminal operation, then it can be elided- elidable (In4 Ret) = True- elidable _ = False+ elidable (In4 Ret) = True+ -- This is a form of double-φ optimisation: If a φ-node points shallowly to a jump, then it can be elided and the jump used instead+ -- Note that this should NOT be done for non-tail calls, as they may generate a large continuation+ elidable (In4 (Pop (In4 (Jump _)))) = True+ elidable _ = False makeΦ m = let n = coinsNeeded m in fmap (\φ -> (In4 . MkJoin φ (addCoins n m), drainCoins n (In4 (Join φ)))) askΦ freshΣ :: CodeGenStack (ΣVar a)