diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-01 17:40:27 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-01 17:40:27 -0400 |
commit | d513c71236b3e91bb999158829250e7194a9d56e (patch) | |
tree | 25c8646476e4613a0bb8a74095cb545fe68402cc | |
parent | d19745afded63276449bb56b7d24c38c7e32d0a7 (diff) | |
download | fork-ledger-d513c71236b3e91bb999158829250e7194a9d56e.tar.gz fork-ledger-d513c71236b3e91bb999158829250e7194a9d56e.tar.bz2 fork-ledger-d513c71236b3e91bb999158829250e7194a9d56e.zip |
Minor optimization
-rw-r--r-- | src/filters.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/filters.cc b/src/filters.cc index 41e8c16b..ad4b88a0 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -665,10 +665,8 @@ void changed_value_posts::output_intermediate_prices(post_t& post, } // Choose the last price from each day as the price to use - typedef std::map<const date_t, - std::pair<const datetime_t, - amount_t> > history_by_date_map; - history_by_date_map all_prices_by_date; + typedef std::map<const date_t, bool> date_map; + date_map pricing_dates; BOOST_REVERSE_FOREACH (const commodity_t::history_map::value_type& price, all_prices) { @@ -676,13 +674,12 @@ void changed_value_posts::output_intermediate_prices(post_t& post, // for that date. DEBUG("filters.revalued", "re-inserting " << price.second << " at " << price.first.date()); - all_prices_by_date.insert(history_by_date_map::value_type - (price.first.date(), price)); + pricing_dates.insert(date_map::value_type(price.first.date(), true)); } // Go through the time-sorted prices list, outputting a revaluation for // each price difference. - foreach (const history_by_date_map::value_type& price, all_prices_by_date) { + foreach (const date_map::value_type& price, pricing_dates) { output_revaluation(post, price.first); last_total = repriced_total; } |