[svn:parrot] r48319 - trunk/src

chromatic at svn.parrot.org chromatic at svn.parrot.org
Wed Aug 4 16:30:13 UTC 2010


Author: chromatic
Date: Wed Aug  4 16:30:13 2010
New Revision: 48319
URL: https://trac.parrot.org/parrot/changeset/48319

Log:
[hash] Removed small hash pseudo-optimization.
It's not as useful as other optimizations, and less code is better anyway.

Modified:
   trunk/src/hash.c

Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c	Wed Aug  4 16:30:09 2010	(r48318)
+++ trunk/src/hash.c	Wed Aug  4 16:30:13 2010	(r48319)
@@ -29,7 +29,6 @@
 
 /* the number of entries above which it's faster to hash the hashval instead of
  * looping over the used HashBuckets directly */
-#define SMALL_HASH_SIZE  4
 #define INITIAL_BUCKETS  8
 
 /* HEADERIZER HFILE: include/parrot/hash.h */
@@ -1291,20 +1290,6 @@
     if (hash->entries <= 0)
         return NULL;
 
-    /* a very fast search for very small hashes */
-    if (hash->entries <= SMALL_HASH_SIZE) {
-        const UINTVAL  entries = hash->entries;
-        UINTVAL        i;
-
-        for (i = 0; i < entries; ++i) {
-            HashBucket * const bucket = hash->buckets + i;
-
-            /* the hash->compare cost is too high for this fast path */
-            if (bucket->key == key)
-                return bucket;
-        }
-    }
-
     /* if the fast search didn't work, try the normal hashing search */
     {
         const UINTVAL hashval = get_hash_val(interp, hash, key);


More information about the parrot-commits mailing list