lib: only memoize in csv reader when there are more than 15 cond. blocks

This commit is contained in:
Dmitry Astapov 2020-06-22 19:12:00 +01:00 committed by Simon Michael
parent 8844ef1b5f
commit 21349c161e

View File

@ -333,15 +333,17 @@ defrules = CsvRules' {
-- | Create CsvRules from the content parsed out of the rules file
mkrules :: CsvRulesParsed -> CsvRules
mkrules rules =
let conditionalblocks = reverse $ rconditionalblocks rules in
let conditionalblocks = reverse $ rconditionalblocks rules
maybeMemo = if length conditionalblocks >= 15 then memo else id
in
CsvRules' {
rdirectives=reverse $ rdirectives rules,
rcsvfieldindexes=rcsvfieldindexes rules,
rassignments=reverse $ rassignments rules,
rconditionalblocks=conditionalblocks,
rblocksassigning = memo (\f -> filter (any ((==f).fst) . cbAssignments) conditionalblocks)
rblocksassigning = maybeMemo (\f -> filter (any ((==f).fst) . cbAssignments) conditionalblocks)
}
--- *** rules parsers
{-