update(userspace/falco): use unordered_set where possible for faster lookups

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce 2022-10-06 16:46:29 +00:00 committed by poiana
parent 909f6d0961
commit 21c2b1f472
2 changed files with 6 additions and 5 deletions

View File

@ -28,6 +28,7 @@ limitations under the License.
#include <string>
#include <atomic>
#include <unordered_set>
namespace falco {
namespace app {
@ -94,11 +95,11 @@ private:
// The set of loaded event sources (by default, the syscall event
// source plus all event sources coming from the loaded plugins)
std::set<std::string> loaded_sources;
std::unordered_set<std::string> loaded_sources;
// The set of enabled event sources (can be altered by using
// the --enable-source and --disable-source options)
std::set<std::string> enabled_sources;
std::unordered_set<std::string> enabled_sources;
// Used to load all plugins to get their info. In capture mode,
// this is also used to open the capture file and read its events
@ -152,7 +153,7 @@ private:
}
// Failure result that causes the program to stop with an error
inline static run_result fatal(std::string err)
inline static run_result fatal(const std::string& err)
{
run_result r;
r.success = false;

View File

@ -16,7 +16,7 @@ limitations under the License.
#pragma once
#include <memory>
#include <set>
#include <unordered_set>
#include <sinsp.h>
#include <token_bucket.h>
@ -34,7 +34,7 @@ enum class syscall_evt_drop_action : uint8_t
EXIT
};
using syscall_evt_drop_actions = std::set<syscall_evt_drop_action>;
using syscall_evt_drop_actions = std::unordered_set<syscall_evt_drop_action>;
class syscall_evt_drop_mgr
{