Procházet zdrojové kódy

Ext2FS: Avoid a String allocation in lookup()

By using find() with a custom finder, we can avoid creating a temporary
key value that's only used for the hash lookup.
Andreas Kling před 6 roky
rodič
revize
ac7a559d96
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      Kernel/FileSystem/Ext2FileSystem.cpp

+ 1 - 1
Kernel/FileSystem/Ext2FileSystem.cpp

@@ -1263,7 +1263,7 @@ InodeIdentifier Ext2FSInode::lookup(StringView name)
     ASSERT(is_directory());
     populate_lookup_cache();
     LOCKER(m_lock);
-    auto it = m_lookup_cache.find(name);
+    auto it = m_lookup_cache.find(name.hash(), [&](auto& entry) { return entry.key == name; });
     if (it != m_lookup_cache.end())
         return { fsid(), (*it).value };
     return {};