Rehash weak hash tables less frequently.
authorLudovic Courtès <ludo@gnu.org>
Thu, 16 Dec 2010 16:07:50 +0000 (17:07 +0100)
committerLudovic Courtès <ludo@gnu.org>
Thu, 16 Dec 2010 22:45:23 +0000 (23:45 +0100)
* libguile/hashtab.c (weak_bucket_assoc): Call `scm_i_rehash' only when
  REMAINING is below `SCM_HASHTABLE_LOWER (table)'.

libguile/hashtab.c

index d5f39cb..b7cc72b 100644 (file)
@@ -222,7 +222,8 @@ weak_bucket_assoc (SCM table, SCM buckets, size_t bucket_index,
       remaining = SCM_HASHTABLE_N_ITEMS (table) - args.removed_items;
       SCM_SET_HASHTABLE_N_ITEMS (table, remaining);
 
-      scm_i_rehash (table, hash_fn, closure, "weak_bucket_assoc");
+      if (remaining < SCM_HASHTABLE_LOWER (table))
+       scm_i_rehash (table, hash_fn, closure, "weak_bucket_assoc");
     }
 
   return result;