On Feb 27, 2010, at 5:37 PM, thierry wrote: > On below tests, ledger v3 is 21 and 46 times slower that ledger v2.
After several days of intensive examination, I think now there is little help for what you're seeing. The slowness comes from (a) the size of your data file and how many commodities you're using, and (b) the correctness and new behavior of --exchange (and, to a lesser extent, -V). To illustrate what I mean, I've added a new command "pricemap". It outputs a DOT file showing the pricing relationships between all commodities in your data file at a given date. To give an example of how complex the situation can be, consider this data file: http://ftp.newartisans.com/pub/exchange.dat At 2009/01/03, the price relationships are as shown here: http://ftp.newartisans.com/pub/090103.png But by 2009/01/10, they have changed significantly: http://ftp.newartisans.com/pub/090110.png When you use --exchange $, Ledger tries to find the most recent conversion to $ that it can. To do this, it considers not only whether a commodity A could be priced in dollars, but whether it could also be priced in terms of B, which could then be priced in dollars. And so on. It must walk the graph of all possible connections to $, truncating the search only if the most recent valuation down that leg is older than the most recent found so far. Sometimes, it can take several hops before the most recent conversion price is found. Note to mention that all of this can happen several times for a single posting: while computing the amount, the running total, to see if a revaluation has occurred, to see if a rounding error has occurred, etc. I have managed to speed things up a fair bit, however, so please try your tests again with the latest 'next' branch. Here are the improvements, using an "acprep opt" build on a 2.26GHz Core i7 (all output going to /dev/null): Before optimization work (current 'master' branch): reg, no flags 6.86s reg, -V 39.23s reg, -X 85.92s After optimization work (current 'next' branch): reg, no flags 5.00s reg, -V 13.39s reg, -X 12.91s John
