-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix for storm issuse #245 hashCode does not work for byte[] #429
Conversation
for #245. |
I don't think this is a good idea as toArray will cause the list to be copied. |
hi nathan. is it ok to implement java.util.Arrays.deepHashCode() in storm code to avoid toArray() copying list. |
Maybe... you'd have to show benchmarks that demonstrate that there's no performance degradation. |
@nathanmarz , I compared hashCode performance of three cases : list.hashCode(), java.util.Arrays.deepHashCode() and deepHashCode() without toArray() copying. The result shows that for array length less than 1M there is little diffenence at ms time level. But deepHashCode's time grows linearly with array length. Since performance degradation for array less than 1M is almost negligible, it's worth to fix the byte[] hashCode problem. And for tuple bigger than 1M performance bottleneck should be network not cpu.
|
The following is the deepHashCode(List a) without toArray() copying
|
I think this would be better implemented using Clojure protocols to avoid the if else else else else... conditionals. It would also be more extensible and more performant. |
OK, I will try to implement it using Clojure. |
@nathanmarz I have implemented it using Clojure. I try to use Clojure protocols as you suggested. I am not so skilled at it and find that protocols is used to define interface with multi different method. So I have not find a way to implement this using protocols and implemented it in another way. Any more suggestion? The new code does not show up since this PR is closed so I made another PR #746. |
use java.util.Arrays.deepHashCode() instead of List.hashCode() for tuple