# # patch "ChangeLog" # from [eb2d404a8e3966af23ba92e0f8c0954328fe1d44] # to [ae327b05181ea4cabdaa2e16bb4553fd053de42e] # # patch "change_set.cc" # from [68528aabba353eadead5e05ca0e2cc30dddd005d] # to [0d8fbd60bb97a9a1c6c598f310af7da400009224] # --- ChangeLog +++ ChangeLog @@ -1,3 +1,8 @@ +2005-04-27 Matt Johnston + + * change_set.cc (confirm_proper_tree): move things out of the loops + for better performance. + 2005-04-26 Matt Johnston * change_set.cc (analyze_rearrangement): get rid of damaged_in_first --- change_set.cc +++ change_set.cc @@ -525,20 +525,26 @@ size_t tid_range = max_tid - min_tid + 1; boost::dynamic_bitset<> confirmed(tid_range); + boost::dynamic_bitset<> ancbits(tid_range); + std::vector ancs; // a set is more efficient, at least in normal + // trees where the number of ancestors is + // significantly less than tid_range + tid curr; + path_item item; for (path_state::const_iterator i = ps.begin(); i != ps.end(); ++i) { - tid curr = i->first; - path_item item = i->second; - std::set ancs; // a set is more efficient, at least in normal - // trees where the number of ancestors is - // significantly less than tid_range + ancs.clear(); + ancbits.reset(); + curr = i->first; + item = i->second; while (confirmed.test(curr - min_tid) == false) { sanity_check_path_item(item); - I(ancs.find(curr) == ancs.end()); - ancs.insert(curr); + I(ancbits.test(curr-min_tid) == false); + ancs.push_back(curr); + ancbits.set(curr-min_tid); if (path_item_parent(item) == root_tid) break; else @@ -555,7 +561,7 @@ I(path_item_type(item) == ptype_directory); } } - for (std::set::const_iterator a = ancs.begin(); a != ancs.end(); a++) + for (std::vector::const_iterator a = ancs.begin(); a != ancs.end(); a++) { confirmed.set(*a - min_tid); }