On Fri, 2003-12-05 at 13:19, Raymond DeCampo wrote: > Paul Smith wrote: > >>The hashcode computation must be fast in itself, at least significantly > >>faster than 'equals' method invocations which return false. > >> > >>I think that String.hashcode computation is kinda slow depending on the JDK > >>because it iterates on ALL the characters of the String.
> I still think that Paul's original point is valid. A millisecond is a > long time on a computer these days. > > What about using the first few characters of the message? I think Ceki is correct though. Since the hashCode usually becomes the index into a bucket, any with the same hashCode end up in the same bucket, and would require a linear search along that buckets list to locate it (using equals). However, since LoggingEvents with the same hashCode will be rare, the cost to generate more uniqueness within the hashCode doesn't seem worth it. Only when the probability increases of LoggingEvents colliding within the same hashCode should effort be made to spread the objects across a wider hashCode space. Paul Smith --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]