From 1a5247c10e79345b91e971c253db4e2830ea2b88 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Wed, 10 Jan 2024 23:46:31 +0800 Subject: [PATCH] [report-utilities] more efficient gnc:accounts-get-commodities don't create intermediate lists which are immediately used and discarded. don't locale-compare commodity names, which has locale-transform overhead, and creates lots of temporary strings. testing for duplicates via O(N) member is very adequate because num(unique commodities) is expected to be small. use the stack when accumulating commodities, avoiding need to prepend and reverse. --- gnucash/report/commodity-utilities.scm | 7 +------ gnucash/report/report-utilities.scm | 13 +++++-------- gnucash/report/reports/standard/balsheet-pnl.scm | 7 +------ .../reports/standard/test/test-balsheet-pnl.scm | 2 +- 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/gnucash/report/commodity-utilities.scm b/gnucash/report/commodity-utilities.scm index 8e30d2fbee..44173e6cb1 100644 --- a/gnucash/report/commodity-utilities.scm +++ b/gnucash/report/commodity-utilities.scm @@ -229,12 +229,7 @@ (gnc-account-get-descendants-sorted (gnc-get-current-root-account))) (all-splits (get-all-splits currency-accounts end-date)) (interesting-splits (sort (filter interesting-split? all-splits) datetable-row-col sxml 1 3 6)) (test-equal "show-rates enabled" - '("#1.00" "$1.7000" "1 FUNDS" "$480 + 85/104") + '("1 FUNDS" "$480 + 85/104" "#1.00" "$1.7000") (sxml->table-row-col sxml 2 #f #f))) ;;make-multilevel