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

Make Checksummer faster and more correct #1693

Merged
merged 1 commit into from Apr 4, 2024

Conversation

denisdefreyne
Copy link
Member

@denisdefreyne denisdefreyne commented Apr 4, 2024

Detailed description

The new implementation is faster because of two reasons:

  • It more aggressively avoids calculating checksums of already-calculated items
  • It effectfully updates a hash rather than using Immutable::Set

Preliminary tests suggest a 30% speedup, but I have not at all tested this out properly.

It is also more correct because it replaces use of with a numerical reference to a previously-seen object.

Each newly checksummed object will have a number suffix, e.g. Array#5<…>. Each previously seen object will have an @-reference, e.g. Array#9<@4,@5,>.

This will invalidate existing stored checksums in Nanoc sites, but it is unavoidable and worth the tradeoff.

To do

  • Tests

Related issues

This does not fix #1692 yet, but it brings the checksummer in a better state to handle it.

The new implementation is faster because of two reasons:

- It more aggressively avoids calculating checksums of already-calculated items
- It effectfully updates a hash rather than using Immutable::Set

It is also more correct because it replaces use of <recur> with a numerical reference to a previously-seen object.

Each newly checksummed object will have a number suffix, e.g.
`Array#5<…>`. Each previously seen object will have an @-reference, e.g.
`Array#9<@4,@5,>`.

This will invalidate existing stored checksums in Nanoc sites, but it is unavoidable and worth the tradeoff.
@denisdefreyne denisdefreyne marked this pull request as ready for review April 4, 2024 13:41
@denisdefreyne denisdefreyne merged commit bb603a3 into main Apr 4, 2024
4 checks passed
@denisdefreyne denisdefreyne deleted the denis/faster-checksummer branch April 4, 2024 13:41
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.

CalculateChecksums hangs with mutually referencing objects.
1 participant