On Wed, 12 Nov 2003, Leopold Toetsch wrote: > Dan Sugalski wrote: > > > On Wed, 12 Nov 2003, Steve Fink wrote: > >>... ($x eq $y) ... couldn't this be > >>done as another string vtable entry instead of being specific to > >>hash_compare? > >> > > > > Yeah, that'd be a better way to do it. Add a string_equal function to > > string.c and do the magic there instead. > > Good point. Its for sure worth. But the compare inside the hash can and > should be optimized further. When there is a hash-value collision, the > string_compare is called repeatedly. So a necessary string transcoding > should be done before.
You're going to run into problems no matter what you do, and as transcoding could happen with each comparison arguably you need to make a local copy of the string for each comparison, as otherwise you run the risk of significant data loss as a sring gets transcoded back and forth across a lossy boundary. Regardless, I think at least a single string copy with comparison against that copy within the hash functions is the only way to get correct results. Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk