[Lldb-commits] [lldb] r278286 - Fix the lookup of dictionary values by name to not do a linear search.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 10 13:37:45 PDT 2016


Author: gclayton
Date: Wed Aug 10 15:37:45 2016
New Revision: 278286

URL: http://llvm.org/viewvc/llvm-project?rev=278286&view=rev
Log:
Fix the lookup of dictionary values by name to not do a linear search.


Modified:
    lldb/trunk/include/lldb/Core/StructuredData.h

Modified: lldb/trunk/include/lldb/Core/StructuredData.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/StructuredData.h?rev=278286&r1=278285&r2=278286&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/StructuredData.h (original)
+++ lldb/trunk/include/lldb/Core/StructuredData.h Wed Aug 10 15:37:45 2016
@@ -542,14 +542,9 @@ public:
             if (!key.empty())
             {
                 ConstString key_cs(key);
-                for (collection::const_iterator iter = m_dict.begin(); iter != m_dict.end(); ++iter)
-                {
-                    if (key_cs == iter->first)
-                    {
-                        value_sp = iter->second;
-                        break;
-                    }
-                }
+                collection::const_iterator iter = m_dict.find(key_cs);
+                if (iter != m_dict.end())
+                    value_sp = iter->second;
             }
             return value_sp;
         }




More information about the lldb-commits mailing list