cluster/Telemetry: Avoid unneeded StringVal() construction

This commit is contained in:
Arne Welzel 2025-06-26 17:12:06 +02:00
parent dad5ccd622
commit be8b4747c4

View file

@ -22,11 +22,7 @@ TableTopicNormalizer::TableTopicNormalizer() {
} }
std::string_view TableTopicNormalizer::operator()(std::string_view topic) { std::string_view TableTopicNormalizer::operator()(std::string_view topic) {
// TODO: It'd be nice if we could just lookup via string_view so we can VectorValPtr r = topic_normalizations->LookupPattern(topic);
// avoid the allocation of the intermediary StringVal just to match
// against the patterns.
auto sv = zeek::make_intrusive<zeek::StringVal>(topic);
VectorValPtr r = topic_normalizations->LookupPattern(sv);
if ( r->Size() == 0 ) if ( r->Size() == 0 )
return topic; return topic;