From cbc985d41142b9625e7935980852773baae98f5d Mon Sep 17 00:00:00 2001 From: Stephen Morgan Date: Thu, 3 Feb 2022 20:35:39 +1100 Subject: [PATCH] dev: reg: areg: Speed up reg and areg by only aligning to first 1000 items. --- hledger/Hledger/Cli/Commands/Aregister.hs | 4 ++-- hledger/Hledger/Cli/Commands/Register.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Aregister.hs b/hledger/Hledger/Cli/Commands/Aregister.hs index 4a3c2a26c..82c7cbc6c 100644 --- a/hledger/Hledger/Cli/Commands/Aregister.hs +++ b/hledger/Hledger/Cli/Commands/Aregister.hs @@ -130,8 +130,8 @@ accountTransactionsReportAsText copts reportq thisacctq items = TB.toLazyText $ title <> TB.singleton '\n' <> lines where lines = foldMap (accountTransactionsReportItemAsText copts reportq thisacctq amtwidth balwidth) items - amtwidth = maximumStrict $ 12 : widths (map itemamt items) - balwidth = maximumStrict $ 12 : widths (map itembal items) + amtwidth = maximumStrict $ 12 : widths (map itemamt $ take 1000 items) + balwidth = maximumStrict $ 12 : widths (map itembal $ take 1000 items) widths = map wbWidth . concatMap (showMixedAmountLinesB oneLine) itemamt (_,_,_,_,a,_) = a itembal (_,_,_,_,_,a) = a diff --git a/hledger/Hledger/Cli/Commands/Register.hs b/hledger/Hledger/Cli/Commands/Register.hs index c2a08e84e..8c7789fcf 100644 --- a/hledger/Hledger/Cli/Commands/Register.hs +++ b/hledger/Hledger/Cli/Commands/Register.hs @@ -96,8 +96,8 @@ postingsReportAsText :: CliOpts -> PostingsReport -> TL.Text postingsReportAsText opts items = TB.toLazyText lines where lines = foldMap (postingsReportItemAsText opts amtwidth balwidth) items - amtwidth = maximumStrict $ 12 : widths (map itemamt items) - balwidth = maximumStrict $ 12 : widths (map itembal items) + amtwidth = maximumStrict $ 12 : widths (map itemamt $ take 1000 items) + balwidth = maximumStrict $ 12 : widths (map itembal $ take 1000 items) widths = map wbWidth . concatMap (showMixedAmountLinesB oneLine) itemamt (_,_,_,Posting{pamount=a},_) = a itembal (_,_,_,_,a) = a