From 57b90552ebeedee61ffc99b3058ce18608c6fc4d Mon Sep 17 00:00:00 2001 From: Raven Black Date: Fri, 10 May 2024 20:40:22 +0000 Subject: [PATCH] Comment explaining string-view by reference Signed-off-by: Raven Black --- source/common/common/compiled_string_map.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/common/common/compiled_string_map.h b/source/common/common/compiled_string_map.h index b8b0d64ce03d..bccb0d833ec0 100644 --- a/source/common/common/compiled_string_map.h +++ b/source/common/common/compiled_string_map.h @@ -49,6 +49,9 @@ namespace Envoy { * for the string node. */ template class CompiledStringMap { + // While it is usual to take a string_view by value, in this + // performance-critical context with repeatedly passing the same + // value, passing it by reference benchmarks out slightly faster. using FindFn = std::function; public: