From 7016de508cdae8dc94b1ff60e5292859642e4aac Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Wed, 5 Feb 2025 17:39:41 -0800 Subject: Reduce heap allocations in BLASTBufferQueue. * Replace std::unordered_map members with ftl::SmallMap with empirically determined sizes. * Eliminate creating an unnecessary std::vector Test: unit, manual Bug: 285377983 Flag: EXEMPT refactoring Change-Id: I20402bf58d6619573cb1ff85be5092447f841b8a --- include/ftl/small_map.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/ftl/small_map.h b/include/ftl/small_map.h index 83d5967464..96d35cd21e 100644 --- a/include/ftl/small_map.h +++ b/include/ftl/small_map.h @@ -234,6 +234,12 @@ class SmallMap final { // bool erase(const key_type& key) { return erase(key, begin()); } + // Removes a mapping. + // + // The last() and end() iterators, as well as those to the erased mapping, are invalidated. + // + void erase(iterator it) { map_.unstable_erase(it); } + // Removes all mappings. // // All iterators are invalidated. -- cgit v1.2.3-59-g8ed1b