Again, this is the perfetto source code from https://github.com/google/perfetto
src/protozero/filtering/filter_util.cc:328:28: performance: Searching before insertion is not necessary. [stlFindInsert] seen_msgs.insert(nested_type);
The code is as follows:
if (seen_msgs.find(nested_type) == seen_msgs.end()) { seen_msgs.insert(nested_type); queue.emplace_back(result.nested_msg_index, nested_type); }
While I can understand the reason for the warning, the emplace_back command does depend on it, so the find statement can't be removed in any case.
How about this?
void f(std::set<int>& s, int i) { auto [_, b] = s.insert(i); if (b) { dostuff(); } }
Log in to post a comment.
Again, this is the perfetto source code from https://github.com/google/perfetto
The code is as follows:
While I can understand the reason for the warning, the emplace_back command does depend on it, so the find statement can't be removed in any case.
How about this?