# # patch "ChangeLog" # from [3d64a878f7ab1a4d86152743953dc51b6139e256] # to [ba34129b328688fa2cf7d9c6ac00c76ed700db43] # # patch "basic_io.cc" # from [fb9d041c4191d1cd6997e9b4ac65adfb7361e0ef] # to [362c354a98656867a4874ce83f15faf4c63dcaf5] # # patch "change_set.cc" # from [514f646e5cc061ba8bf85e92eebd65357b4c85bf] # to [8b733d5b674155d95c2c8dda60fa99b18acf9c11] # --- ChangeLog +++ ChangeLog @@ -1,5 +1,12 @@ 2005-04-17 Matt Johnston + * change_set.cc (confirm_proper_tree): use a std::set rather than + dynamic_bitset for the ancestor list, improving performance for + common tree structures. + * basic_io.cc: reserve() a string + +2005-04-17 Matt Johnston + * packet.cc: fix up unit test compilation. * transforms.cc: fix up unit test compilation. --- basic_io.cc +++ basic_io.cc @@ -56,6 +56,7 @@ I(std::isalnum(*i) || *i == '_'); std::string escaped; + escaped.reserve(v.size() + 8); for (std::string::const_iterator i = v.begin(); i != v.end(); ++i) --- change_set.cc +++ change_set.cc @@ -525,19 +525,21 @@ size_t tid_range = max_tid - min_tid + 1; boost::dynamic_bitset<> confirmed(tid_range); - boost::dynamic_bitset<> ancs(tid_range); for (path_state::const_iterator i = ps.begin(); i != ps.end(); ++i) { tid curr = i->first; path_item item = i->second; - ancs.reset(); + std::set ancs; // a set is more efficient, at least in normal + // trees where the number of ancestors is + // significantly less than tid_range while (confirmed.test(curr - min_tid) == false) { sanity_check_path_item(item); - I(ancs.test(curr - min_tid) == false); - ancs.set(curr - min_tid); + I(ancs.find(curr) == ancs.end()); + ancs.insert(curr); + confirmed.set(curr - min_tid); if (path_item_parent(item) == root_tid) break; else @@ -554,7 +556,10 @@ I(path_item_type(item) == ptype_directory); } } - confirmed |= ancs; + for (std::set::const_iterator a = ancs.begin(); a != ancs.end(); a++) + { + confirmed.set(*a - min_tid); + } } }