diff --git a/hledger-lib/Hledger/Reports/AccountTransactionsReport.hs b/hledger-lib/Hledger/Reports/AccountTransactionsReport.hs index 395a336b4..fd7bdec97 100644 --- a/hledger-lib/Hledger/Reports/AccountTransactionsReport.hs +++ b/hledger-lib/Hledger/Reports/AccountTransactionsReport.hs @@ -116,7 +116,12 @@ accountTransactionsReport rspec@ReportSpec{_rsReportOpts=ropts} j thisacctq = it -- Additional reportq filtering, such as date filtering, happens down in -- accountTransactionsReportItem, which discards transactions with no matched postings. acctJournal = - ptraceAtWith 5 (("ts3:\n"++).pshowTransactions.jtxns) + -- With most calls we will not require transaction prices past this point, and can get a big + -- speed improvement by stripping them early. In some cases, such as in hledger-ui, we still + -- want to keep prices around, so we can toggle between cost and no cost quickly. We can use + -- the show_costs_ flag to be efficient when we can, and detailed when we have to. + (if show_costs_ ropts then id else journalMapPostingAmounts mixedAmountStripPrices) + . ptraceAtWith 5 (("ts3:\n"++).pshowTransactions.jtxns) -- maybe convert these transactions to cost or value . journalApplyValuationFromOpts rspec . ptraceAtWith 5 (("ts2:\n"++).pshowTransactions.jtxns) diff --git a/hledger-lib/Hledger/Reports/PostingsReport.hs b/hledger-lib/Hledger/Reports/PostingsReport.hs index 234d67047..0e38b5bc6 100644 --- a/hledger-lib/Hledger/Reports/PostingsReport.hs +++ b/hledger-lib/Hledger/Reports/PostingsReport.hs @@ -120,6 +120,11 @@ matchedPostingsBeforeAndDuring rspec@ReportSpec{_rsReportOpts=ropts,_rsQuery=q} sortOn (postingDateOrDate2 (whichDate ropts)) -- sort postings by date or date2 . (if invert_ ropts then map negatePostingAmount else id) -- with --invert, invert amounts . journalPostings + -- With most calls we will not require transaction prices past this point, and can get a big + -- speed improvement by stripping them early. In some cases, such as in hledger-ui, we still + -- want to keep prices around, so we can toggle between cost and no cost quickly. We can use + -- the show_costs_ flag to be efficient when we can, and detailed when we have to. + . (if show_costs_ ropts then id else journalMapPostingAmounts mixedAmountStripPrices) $ journalValueAndFilterPostings rspec{_rsQuery=beforeandduringq} j -- filter postings by the query, with no start date or depth limit diff --git a/hledger-ui/Hledger/UI/RegisterScreen.hs b/hledger-ui/Hledger/UI/RegisterScreen.hs index 71ced2ad5..4963c59f5 100644 --- a/hledger-ui/Hledger/UI/RegisterScreen.hs +++ b/hledger-ui/Hledger/UI/RegisterScreen.hs @@ -69,6 +69,8 @@ rsInit d reset ui@UIState{aopts=_uopts@UIOpts{uoCliOpts=copts@CliOpts{reportspec ropts' = ropts { -- ignore any depth limit, as in postingsReport; allows register's total to match accounts screen depth_=Nothing + -- do not strip prices so we can toggle costs within the ui + , show_costs_=True -- XXX aregister also has this, needed ? -- always show historical balance -- , balanceaccum_= Historical