read: only run finalise twice if there are modifiers
Previously we ran if `--auto` was set. But this adds a small performance hit if `--auto` becomes default. Now we only run twice if there are transactionModifiers AND `--auto` is set. So even if auto is specified, there will be no penalty if there are no modifiers.
This commit is contained in:
parent
6c3fb56603
commit
20f134c96b
@ -264,7 +264,7 @@ parseAndFinaliseJournal parser iopts f txt = do
|
|||||||
-- the options for checking assertions.
|
-- the options for checking assertions.
|
||||||
let runFin :: Bool -> Bool -> (ParsedJournal -> Either String Journal)
|
let runFin :: Bool -> Bool -> (ParsedJournal -> Either String Journal)
|
||||||
runFin reorder ignore = journalFinalise t f txt reorder ignore
|
runFin reorder ignore = journalFinalise t f txt reorder ignore
|
||||||
fj = if auto_ iopts
|
fj = if auto_ iopts && (not . null . jtxnmodifiers) pj
|
||||||
then applyTransactionModifiers <$>
|
then applyTransactionModifiers <$>
|
||||||
runFin True False pj >>=
|
runFin True False pj >>=
|
||||||
runFin False (not $ ignore_assertions_ iopts)
|
runFin False (not $ ignore_assertions_ iopts)
|
||||||
@ -295,7 +295,7 @@ parseAndFinaliseJournal' parser iopts f txt = do
|
|||||||
-- options for checking assertions.
|
-- options for checking assertions.
|
||||||
let runFin :: Bool -> Bool -> (ParsedJournal -> Either String Journal)
|
let runFin :: Bool -> Bool -> (ParsedJournal -> Either String Journal)
|
||||||
runFin reorder ignore = journalFinalise t f txt reorder ignore
|
runFin reorder ignore = journalFinalise t f txt reorder ignore
|
||||||
fj = if auto_ iopts
|
fj = if auto_ iopts && (not . null . jtxnmodifiers) pj
|
||||||
then applyTransactionModifiers <$>
|
then applyTransactionModifiers <$>
|
||||||
runFin True False pj >>=
|
runFin True False pj >>=
|
||||||
runFin False (not $ ignore_assertions_ iopts)
|
runFin False (not $ ignore_assertions_ iopts)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user