[Openmcl-devel] Is it safe to make hash tables with non-standard tests?

Ron Garret ron at flownet.com
Sat Jul 20 10:09:20 PDT 2013


I care more about safety than I do about efficiency, though all else being equal I'd rather be more efficient than less.  But I'm already doing quite a bit of string processing when I'm unmarshalling a data structure (which is where this code comes into play) and identifiers tend to be short (and modern processors are fast) so I'm not too worried about the cost of the hash function.

rg

On Jul 20, 2013, at 1:43 AM, Willem Rein Oudshoorn wrote:

> Ron Garret <ron at flownet.com> writes:
> 
>> 
>> 
>> I was actually going to use (sxhash (string-upcase (princ-to-string thing))) as the hash function, and STRING-EQUAL as the test.
>> 
> 
> This is a bit late maybe, but if you care about efficiency and safety,
> it is maybe better to either write your own datastructure, or wrap the
> hashtable with well defined accessor methods which will do the checks.
> 
> I mention this because if you use the hash function as defined above, it
> will create at least two temporary strings for each hash table access.
> And I guess that the string-upcase function has to do some work 
> with respect to unicode etc.
> 
> Wim Oudshoorn.
> 
> 
> 
> 
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel




More information about the Openmcl-devel mailing list