Skip to content

Commit

Permalink
Comment explaining string-view by reference
Browse files Browse the repository at this point in the history
Signed-off-by: Raven Black <ravenblack@dropbox.com>
  • Loading branch information
ravenblackx committed May 10, 2024
1 parent 7ece7eb commit 57b9055
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/common/common/compiled_string_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ namespace Envoy {
* for the string node.
*/
template <class Value> 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<Value(const absl::string_view&)>;

public:
Expand Down

0 comments on commit 57b9055

Please sign in to comment.