[Openmcl-devel] hash table resizing

Gary Byers gb at clozure.com
Tue Jul 28 04:21:47 UTC 2009


If all of the calls to (SETF GETHASH) on the table of interest happen in a small
number of places, you could consider changing the code to do something like:

(let* ((oldsize (hash-table-size table)))
   (prog1
      (setf (gethash key table) value)
      (let* ((newsize (hash-table-size table)))
        (when (> newsize oldsize)
          (format t "~& size of ~s changed from ~s to ~s." table oldsize newsize)))))

There are some cases that that wouldn't catch - if a hash table's had a lot of
deleted entries, it might need to get rehashed (to replace the "deleted" entries
with "free" entries) but not actually have its HASH-TABLE-SIZE change - but the
code above is simple and would catch the case of actual growth.

I'm a little hesitant to suggest that you just trace some internal function 
unless you can be very sure that you're doing it in a way where things only
get printed if your hash table's growing (and not when some hash table used
by the object system or other internal things are growing.)


On Mon, 27 Jul 2009, Jared C. Davis wrote:

> Hi,
>
> Is there a way to see when a hash table is being resized?
>
> If I could just even have it print a message, that'd be great, just
> for performance debugging on a special table.
>
> Thanks,
> Jared
>
> -- 
> Jared C. Davis <jared at cs.utexas.edu>
> 11410 Windermere Meadows
> Austin, TX 78759
> http://www.cs.utexas.edu/users/jared/
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list