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. Finally the string_compare inside hash is either a strcmp() or a compare of strings of the same encoding/type called via the compare function pointer.



Dan

leo




Reply via email to