diff options
| author | Alan Conway <aconway@apache.org> | 2009-05-06 17:58:50 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2009-05-06 17:58:50 +0000 |
| commit | d37792b0cd112986236addbcde01ee55067c946b (patch) | |
| tree | be815e2111c6e7dfc629e2a8bd1742dceb9f6e81 /cpp/src/qpid/broker/TxAccept.cpp | |
| parent | f4a17848cf8a9129466369eb153511dfd6879380 (diff) | |
| download | qpid-python-d37792b0cd112986236addbcde01ee55067c946b.tar.gz | |
DeliveryRecord optimizations.
Replace linear search with binary search.
Collapse multi-pass mark-then-erase to a signle pass.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@772384 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/TxAccept.cpp')
| -rw-r--r-- | cpp/src/qpid/broker/TxAccept.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/cpp/src/qpid/broker/TxAccept.cpp b/cpp/src/qpid/broker/TxAccept.cpp index ca128b1975..15a1222a74 100644 --- a/cpp/src/qpid/broker/TxAccept.cpp +++ b/cpp/src/qpid/broker/TxAccept.cpp @@ -58,15 +58,10 @@ void TxAccept::RangeOps::commit() std::for_each(ranges.begin(), ranges.end(), bind(&RangeOp::commit, _1)); //now remove if isRedundant(): if (!ranges.empty()) { - DeliveryRecords::iterator i = ranges.front().range.start; + DeliveryRecords::iterator begin = ranges.front().range.start; DeliveryRecords::iterator end = ranges.back().range.end; - while (i != end) { - if (i->isRedundant()) { - i = unacked.erase(i); - } else { - i++; - } - } + DeliveryRecords::iterator removed = remove_if(begin, end, mem_fun_ref(&DeliveryRecord::isRedundant)); + unacked.erase(removed, end); } } |
