clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

It would be nice to compute one hash per string and use that during insertion. 
I really like the patch, but can we avoid two string hashes?


================
Comment at: source/Core/ConstString.cpp:147-152
@@ -165,7 +146,8 @@
 protected:
-    //------------------------------------------------------------------
-    // Typedefs
-    //------------------------------------------------------------------
-    typedef StringPool::iterator iterator;
-    typedef StringPool::const_iterator const_iterator;
+    uint8_t
+    hash(const llvm::StringRef &s)
+    {
+        uint32_t h = llvm::HashString(s);
+        return ((h >> 24) ^ (h >> 16) ^ (h >> 8) ^ h) & 0xff;
+    }
 
----------------
Is there a way we can use the hash that llvm uses for its string pool here? We 
are calculating two hashes: one for this to see which pool it will go into, and 
then another when the string is hashed into the string pool object. It would be 
nice if we can calculate the hash once and maybe do/add a string pool insertion 
that the pool with use to verify the string is in the pool or insert it using 
the supplied hash?


http://reviews.llvm.org/D13652



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to