hledger/hledger-lib
Simon Michael f78dc639a5 fix a slowdown with report rendering in 1.19.1 (#1350)
stripAnsi is called many times during rendering (by strWidth), so
should be fast. It was originally a regex replacement, and more
recently a custom parser. The parser was slower, particularly the one
in 1.19.1. See #1350, and this rough test:

time118ish = timeIt $ print $ length $ concat $ map (fromRight undefined . regexReplace (toRegex' "\ESC\\[([0-9]+;)*([0-9]+)?[ABCDHJKfmsu]") "") testdata
time119    = timeparser (many (takeWhile1P Nothing (/='\ESC') <|> "" <$ ansi))
time1191   = timeparser (many ("" <$ try ansi <|> pure <$> anySingle))
timeparser p = timeIt $ print $ length $ concat $ map (concat . fromJust . parseMaybe p) testdata
testdata = concat $ replicate 10000
    [ "2008-01-01 income               assets🏦checking            $1            $1"
    , "2008-06-01 gift                 assets🏦checking            $1            $2"
    , "2008-06-02 save                 assets🏦saving              $1            $3"
    , "                                assets🏦checking  ..m$-1\ESC[m\ESC[m            $2"
    , "2008-06-03 eat & shop           assets:cash           ..m$-2\ESC[m\ESC[m             0"
    , "2008-12-31 pay off              assets🏦checking  ..m$-1\ESC[m\ESC[m  ..m$-1\ESC[m\ESC[m"
    ]

ghci> time118ish
4560000
CPU time:   0.17s
ghci> time119
4560000
CPU time:   0.91s
ghci> time1191
4560000
CPU time:   2.76s

Possibly a more careful parser could beat regexReplace. Note the
latter does memoisation, which could be faster and/or could also use
more resident memory in some situations.

Ideally we would calculate all widths before adding ANSI colour codes,
so we wouldn't have to wastefully strip them.
2020-09-10 18:07:40 -07:00
..
Hledger fix a slowdown with report rendering in 1.19.1 (#1350) 2020-09-10 18:07:40 -07:00
other/ledger-parse lib: restrict imports, avoiding GHCI clashes 2016-11-20 10:27:16 -08:00
test ci: --pedantic is too much for now 2020-03-07 14:53:12 -08:00
Text cli:Fixed NoLine column rendering after previous commit 2020-02-29 12:56:35 -08:00
.ghci tools: .ghci for each package, sets shorter prompt 2016-04-15 16:06:45 -07:00
.version ; bump hledger-lib, hledger, hledger-ui, hledger-web version to 1.19.99 2020-09-07 12:16:12 -07:00
CHANGES.md ;update changelogs 2020-09-07 16:17:58 -07:00
defs.m4 ; bump hledger-lib, hledger, hledger-ui, hledger-web version to 1.19.99 2020-09-07 12:16:12 -07:00
hledger_csv.5 ;update manuals 2020-09-07 12:17:35 -07:00
hledger_csv.info ;update manuals 2020-09-07 12:17:35 -07:00
hledger_csv.m4.md ;doc: clarify csv file extensions and separator inferring 2020-08-21 09:01:23 -07:00
hledger_csv.txt ;update manuals 2020-09-07 12:17:35 -07:00
hledger_journal.5 ;update manuals 2020-09-07 12:17:35 -07:00
hledger_journal.info ;update manuals 2020-09-07 12:17:35 -07:00
hledger_journal.m4.md ;doc: journal: redundant budget report link 2020-09-08 07:55:07 -07:00
hledger_journal.txt ;update manuals 2020-09-07 12:17:35 -07:00
hledger_timeclock.5 ;update manuals 2020-09-07 12:17:35 -07:00
hledger_timeclock.info ;update manuals 2020-09-07 12:17:35 -07:00
hledger_timeclock.m4.md ;doc: drop redundant version message from web manuals 2020-01-25 19:33:12 -08:00
hledger_timeclock.txt ;update manuals 2020-09-07 12:17:35 -07:00
hledger_timedot.5 ;update manuals 2020-09-07 12:17:35 -07:00
hledger_timedot.info ;update manuals 2020-09-07 12:17:35 -07:00
hledger_timedot.m4.md ;timedot: update docs 2020-03-01 14:06:29 -08:00
hledger_timedot.txt ;update manuals 2020-09-07 12:17:35 -07:00
hledger-lib.cabal ;update cabal files 2020-09-07 12:17:35 -07:00
Hledger.hs rename easytests_* to tests_* 2018-09-06 13:13:26 -07:00
LICENSE split off hledger-lib package, containing core types & utils 2010-03-22 01:44:59 +00:00
package.yaml ; bump hledger-lib, hledger, hledger-ui, hledger-web version to 1.19.99 2020-09-07 12:16:12 -07:00
README.md ;doc: more tweaks to package readmes, hackage descriptions 2020-03-22 10:49:02 -07:00
Setup.hs Revert "remove Setup.hs files again, fixing a yesod devel warning" 2014-05-24 13:39:09 -07:00

hledger-lib

A reusable library containing hledgers core functionality. This is used by most hledger* packages so that they support the same common file formats, command line options, reports etc.

See also: the project README and home page.