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

Use Hamster::Set in checksummer for speed #887

merged 1 commit into from Jul 1, 2016


Copy link

@ddfreyne ddfreyne commented Jul 1, 2016

Using Ruby’s Set in an immutable way is slow. Hamster::Set, from Hamster, is significantly faster.

Example: 1138s → 50s

Fixes #864.


if visited.include?(obj)
behavior_for(obj).update(obj, digest) { |o| update(o, digest, visited + [obj]) }
behavior_for(obj).update(obj, digest) { |o| update(o, digest, visited.add(obj)) }
Copy link
Member Author

@ddfreyne ddfreyne Jul 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could’ve left it that way, but #add is a nicer API, and it’s likely faster as well.


@ddfreyne ddfreyne merged commit b2d0fb8 into release-4.2.x Jul 1, 2016
1 check passed
@ddfreyne ddfreyne deleted the hamster-set-in-checksummer branch Jul 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant