rtp_rtcp: use webrtc::flat_map for remote_senders
This one is frequently accessed - Mainly by ::CreateReportBlocks and
is visible in performance profiles (although not very much).
By using webrtc::flat_map, better data cache locality is expected.
Bug: webrtc:12689
Change-Id: Ic2ebcad806788074b2b4cb244a25395a48df1852
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232541
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35054}
diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn
index 950e832..00431dc 100644
--- a/modules/rtp_rtcp/BUILD.gn
+++ b/modules/rtp_rtcp/BUILD.gn
@@ -378,6 +378,7 @@
"../../api/video:video_bitrate_allocation",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
+ "../../rtc_base/containers:flat_map",
"../../rtc_base/task_utils:repeating_task",
"../../rtc_base/task_utils:to_queued_task",
"../../system_wrappers",
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_impl.h b/modules/rtp_rtcp/source/rtcp_transceiver_impl.h
index 91dc496..b03db7d 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_impl.h
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_impl.h
@@ -25,6 +25,7 @@
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "modules/rtp_rtcp/source/rtcp_packet/target_bitrate.h"
#include "modules/rtp_rtcp/source/rtcp_transceiver_config.h"
+#include "rtc_base/containers/flat_map.h"
#include "rtc_base/task_utils/repeating_task.h"
#include "system_wrappers/include/ntp_time.h"
@@ -118,7 +119,7 @@
absl::optional<rtcp::Remb> remb_;
// TODO(danilchap): Remove entries from remote_senders_ that are no longer
// needed.
- std::map<uint32_t, RemoteSenderState> remote_senders_;
+ flat_map<uint32_t, RemoteSenderState> remote_senders_;
RepeatingTaskHandle periodic_task_handle_;
};