From cbdd86f4dc58300b3f06deb986c7f097b8514727 Mon Sep 17 00:00:00 2001 From: Stephen Morgan Date: Sat, 12 Mar 2022 09:57:57 +1100 Subject: [PATCH] imp: reg: areg: Align to first 1000 postings by default, rather than 100. This has the same performance characteristics for a big decrease in alignment issues. 1000 postings seems to still put it under the memory bottleneck. --- hledger/Hledger/Cli/Commands/Aregister.md | 2 +- hledger/Hledger/Cli/Commands/Register.md | 2 +- hledger/Hledger/Cli/Utils.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Aregister.md b/hledger/Hledger/Cli/Commands/Aregister.md index 540b635f3..0a8f3f299 100644 --- a/hledger/Hledger/Cli/Commands/Aregister.md +++ b/hledger/Hledger/Cli/Commands/Aregister.md @@ -48,7 +48,7 @@ Each `aregister` line item shows: Transactions making a net change of zero are not shown by default; add the `-E/--empty` flag to show them. -For performance reasons, column widths are chosen based on the first 100 lines; +For performance reasons, column widths are chosen based on the first 1000 lines; this means unusually wide values in later lines can cause visual discontinuities as column widths are adjusted. If you want to ensure perfect alignment, at the cost of more time and memory, use the `--align-all` flag. diff --git a/hledger/Hledger/Cli/Commands/Register.md b/hledger/Hledger/Cli/Commands/Register.md index 6c426a69e..14044846a 100644 --- a/hledger/Hledger/Cli/Commands/Register.md +++ b/hledger/Hledger/Cli/Commands/Register.md @@ -25,7 +25,7 @@ $ hledger register checking With --date2, it shows and sorts by secondary date instead. -For performance reasons, column widths are chosen based on the first 100 lines; +For performance reasons, column widths are chosen based on the first 1000 lines; this means unusually wide values in later lines can cause visual discontinuities as column widths are adjusted. If you want to ensure perfect alignment, at the cost of more time and memory, use the `--align-all` flag. diff --git a/hledger/Hledger/Cli/Utils.hs b/hledger/Hledger/Cli/Utils.hs index 76cd2330c..60835ebf4 100644 --- a/hledger/Hledger/Cli/Utils.hs +++ b/hledger/Hledger/Cli/Utils.hs @@ -268,7 +268,7 @@ postingsOrTransactionsReportAsText alignAll opts itemAsText itemamt itembal repo mconcat . snd $ mapAccumL renderItem (startWidth amt, startWidth bal) itemsWithAmounts where minWidth = 12 - chunkSize = 100 + chunkSize = 1000 renderItem (amtWidth, balWidth) item@(_, amt, bal) = ((amtWidth', balWidth'), itemBuilder) where