gnucash stable: [html-chart] minor optimisation to nested-alist-set!
Christopher Lam
clam at code.gnucash.org
Sat May 24 00:04:05 EDT 2025
Updated via https://github.com/Gnucash/gnucash/commit/03581932 (commit)
from https://github.com/Gnucash/gnucash/commit/61fe756a (commit)
commit 035819323fd9c344260521ddcbfe640204159732
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat May 24 12:02:11 2025 +0800
[html-chart] minor optimisation to nested-alist-set!
because both list-cdr-set! and length are O(N)
diff --git a/gnucash/report/html-chart.scm b/gnucash/report/html-chart.scm
index 58a6e08428..825f95efbe 100644
--- a/gnucash/report/html-chart.scm
+++ b/gnucash/report/html-chart.scm
@@ -107,8 +107,7 @@
((head . tail)
(let ((pair (assq head nested-lst)))
(cond
- ((not pair) (list-cdr-set! nested-lst (1- (length nested-lst))
- (path->nested-alist path newval)))
+ ((not pair) (set-cdr! (last-pair nested-lst) (path->nested-alist path newval)))
((null? tail) (set-cdr! pair newval))
(else (loop (cdr pair) tail))))))))
Summary of changes:
gnucash/report/html-chart.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
More information about the gnucash-changes
mailing list