Hashtables

24.1  Caching

The specification notes that hashtables are allowed to cache the results of calling the hash function and equivalence function, and that any hashtable operation may call the hash function more than once. Hashtable lookups are often followed by updates, so caching may improve performance. Hashtables are free to change their internal representation at any time, which may result in many calls to the hash function.

24.2  Immutable hashtables

Hashtable references may be less expensive with immutable hashtables. Also, the creator of a hashtable may wish to prevent modifications, particularly by code outside of the creator’s control.

24.3  Hash functions

The make-eq-hashtable and make-eqv-hashtable constructors are designed to hide their hash function. This allows implementations to use the machine address of an object as its hash value, rehashing parts of the table as necessary if a garbage collector moves objects to different addresses.