Move QuicIntervalSet:Set allocator template argument to internal platform impl.
Also rename QuicOrderedSet to QuicSmallOrderedSet to reflect that this
container is optimized for small sets.
Before this change Set is some_internal_container<absl::InlinedVector>
(preferred) internally and absl::btree_set<std::vector> in Chromium.
After this change Set is the same internally but absl::btree_set (without the
extra allocator argument) in Chromium.
Chromium's QuicOrderedSetImpl should later be changed to base::flat_set, which
aligns better with the performance properties of the internal implementation
(and the performance requirements of QuicIntervalSet) than absl::btree_set.
This change unblocks changing Chromium's QuicInlinedVectorImpl from std::vector
to absl::InlinedVector, which is currently not possible because
absl::btree_set<absl::InlinedVector> does not compile.
PiperOrigin-RevId: 379947057
diff --git a/quic/core/quic_interval_set.h b/quic/core/quic_interval_set.h
index fef0893..d69fa71 100644
--- a/quic/core/quic_interval_set.h
+++ b/quic/core/quic_interval_set.h
@@ -85,9 +85,7 @@
bool operator()(T&& point, const value_type& a) const;
};
- using Set = QuicOrderedSet<value_type,
- IntervalLess,
- QuicInlinedVector<value_type, 10>>;
+ using Set = QuicSmallOrderedSet<value_type, IntervalLess>;
public:
using const_iterator = typename Set::const_iterator;
diff --git a/quic/platform/api/quic_containers.h b/quic/platform/api/quic_containers.h
index 26bd3d4..be836db 100644
--- a/quic/platform/api/quic_containers.h
+++ b/quic/platform/api/quic_containers.h
@@ -13,13 +13,13 @@
template <typename T, size_t N, typename A = std::allocator<T>>
using QuicInlinedVector = QuicInlinedVectorImpl<T, N, A>;
-// An ordered set of values.
+// An ordered container optimized for small sets.
+// An implementation with O(n) mutations might be chosen
+// in case it has better memory usage and/or faster access.
//
// DOES NOT GUARANTEE POINTER OR ITERATOR STABILITY!
-template <typename Key,
- typename Compare = std::less<Key>,
- typename Rep = std::vector<Key>>
-using QuicOrderedSet = QuicOrderedSetImpl<Key, Compare, Rep>;
+template <typename Key, typename Compare = std::less<Key>>
+using QuicSmallOrderedSet = QuicSmallOrderedSetImpl<Key, Compare>;
} // namespace quic