From 21c2b1f472be9581474c3f99c8f025c6f070ca93 Mon Sep 17 00:00:00 2001 From: Jason Dellaluce Date: Thu, 6 Oct 2022 16:46:29 +0000 Subject: [PATCH] update(userspace/falco): use unordered_set where possible for faster lookups Signed-off-by: Jason Dellaluce --- userspace/falco/application.h | 7 ++++--- userspace/falco/event_drops.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/userspace/falco/application.h b/userspace/falco/application.h index 0cc761b8..10b50b62 100644 --- a/userspace/falco/application.h +++ b/userspace/falco/application.h @@ -28,6 +28,7 @@ limitations under the License. #include #include +#include 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 loaded_sources; + std::unordered_set loaded_sources; // The set of enabled event sources (can be altered by using // the --enable-source and --disable-source options) - std::set enabled_sources; + std::unordered_set 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; diff --git a/userspace/falco/event_drops.h b/userspace/falco/event_drops.h index 428e054d..ff8d78b6 100644 --- a/userspace/falco/event_drops.h +++ b/userspace/falco/event_drops.h @@ -16,7 +16,7 @@ limitations under the License. #pragma once #include -#include +#include #include #include @@ -34,7 +34,7 @@ enum class syscall_evt_drop_action : uint8_t EXIT }; -using syscall_evt_drop_actions = std::set; +using syscall_evt_drop_actions = std::unordered_set; class syscall_evt_drop_mgr {