-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Optimization + inplace operations #14
Conversation
Thanks, Daniel. I will review. On Tue, Feb 11, 2014 at 11:13 AM, Daniel Lemire [email protected]:
Will |
Optimization + inplace operations
Thanks, Daniel. I merged these changes into develop and master. On Tue, Feb 11, 2014 at 11:25 AM, Will Fitzgerald <[email protected]
Will |
Points to consider:
I have added inplace operations. These can be very useful, as they can avoid an unnecessary copy. For fun, consider the case where you have two bloom filters, but you want to merge them. A simple in-place union would be best.
I suggest being conservative about modifying the object. For example, when calling "Equal", it is kind of surprising that the calling object would be modified. This could lead to evil bugs.
For the intersection, union... operations, you had a loop with an embedded if clause. I don't know if the compiler is smart enough to optimize this away. Maybe. Maybe not. I have rewritten the code so that you don't have to rely on having a smart compiler.
I have modified the NextSet function is that it is more Go-ish. I don't know whether it is better, faster... I did not benchmark it, but it feels nicer to me.
Though I have not fixed it, I think that there is a deeper design issue. My understanding is that we access slices/arrays using an int type index in Go. Slice lengths are similarly int-valued. So you are doing a lot of messing around with uints, but this is not necessary, I think.