Build the pruned list with cons, not append.

It is 10x faster against a large dataset.

Insight from Christopher Lam.
pull/1744/head
Jeremy White 3 years ago committed by John Ralls
parent af11a549e3
commit 9cacaa72e8

@ -499,10 +499,11 @@
(G_ (format #f "Warning: cannot find commodity for symbol ~a." current-symbol))))))
(if (not (equal? commodity #f))
(if (not (duplicate-price? pricedb commodity default-currency price))
(set! pruned-prices (append pruned-prices (list price)))
(set! pruned-prices (cons price pruned-prices))
(set! pruned-price-count (+ 1 pruned-price-count))))
(update-progress))
sorted-prices)
(set! pruned-prices (reverse pruned-prices))
(if progress-dialog
(begin

Loading…
Cancel
Save