From e378159ea862994d0f3381a1067631e4400f6bdb Mon Sep 17 00:00:00 2001 From: CedricMocquillon Date: Sat, 1 May 2021 23:21:21 +0200 Subject: [PATCH] Use O(log(n)) search instead of O(n) --- components/vfs/filesystemarchive.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/components/vfs/filesystemarchive.cpp b/components/vfs/filesystemarchive.cpp index 17f3891ec..6eef4b93a 100644 --- a/components/vfs/filesystemarchive.cpp +++ b/components/vfs/filesystemarchive.cpp @@ -55,12 +55,7 @@ namespace VFS bool FileSystemArchive::contains(const std::string& file, char (*normalize_function)(char)) const { - for (const auto& it : mIndex) - { - if(it.first == file) - return true; - } - return false; + return mIndex.find(file) != mIndex.end(); } std::string FileSystemArchive::getDescription() const