Skip to content
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

Merged
merged 4 commits into from
Feb 12, 2014
Merged

Optimization + inplace operations #14

merged 4 commits into from
Feb 12, 2014

Conversation

lemire
Copy link
Member

@lemire lemire commented Feb 11, 2014

Points to consider:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

@willf
Copy link
Collaborator

willf commented Feb 11, 2014

Thanks, Daniel. I will review.

On Tue, Feb 11, 2014 at 11:13 AM, Daniel Lemire [email protected]:

Points to consider:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

You can merge this Pull Request by running

git pull https://github.com/lemire/bitset master

Or view, comment on, or merge it at:

#14
Commit Summary

  • Readme should document how to iterate over set bits.
  • Merge remote-tracking branch 'upstream/develop'
  • Updated the iteration routines
  • Now with inplace operations

File Changes

Patch Links:


Reply to this email directly or view it on GitHubhttps://github.com//pull/14
.

Will

willf added a commit that referenced this pull request Feb 12, 2014
Optimization + inplace operations
@willf willf merged commit d071573 into bits-and-blooms:develop Feb 12, 2014
@willf
Copy link
Collaborator

willf commented Feb 12, 2014

Thanks, Daniel. I merged these changes into develop and master.

On Tue, Feb 11, 2014 at 11:25 AM, Will Fitzgerald <[email protected]

wrote:

Thanks, Daniel. I will review.

On Tue, Feb 11, 2014 at 11:13 AM, Daniel Lemire [email protected]:

Points to consider:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

You can merge this Pull Request by running

git pull https://github.com/lemire/bitset master

Or view, comment on, or merge it at:

#14
Commit Summary

  • Readme should document how to iterate over set bits.
  • Merge remote-tracking branch 'upstream/develop'
  • Updated the iteration routines
  • Now with inplace operations

File Changes

Patch Links:


Reply to this email directly or view it on GitHubhttps://github.com//pull/14
.

Will

Will

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants