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


None yet
1 participant
Copy link

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)) }

This comment has been minimized.

Copy link

ddfreyne Jul 1, 2016

Author Member

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

continuous-integration/travis-ci/pr The Travis CI build 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
You can’t perform that action at this time.