Backup: zip-compress output (.pgn.zip) instead of plain PGN (#91)#102
Merged
Conversation
`chess-db backup` (and the GUI Backup action) now writes a timestamped `.pgn.zip` — a single deflated `.pgn` entry — instead of an uncompressed `.pgn`. PGN is text, so this typically shrinks backups several-fold, `.zip` opens natively on every OS, and the entry round-trips back through the importer's existing zip reader. Games are streamed straight into the archive rather than concatenated into one big in-memory String first. Adds a round-trip test (backup → read the zip → both games present) and updates the Maintenance panel's example filename + CHANGELOG. Closes #91. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gaUhu1KVkdxAjSJBLgbbk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #91.
chess-db backup(and the GUI's Backup action) now writes a timestamped.pgn.zip— a single Deflate-compressed.pgnentry — instead of an uncompressed.pgn.Why zip (and why not zstd)
Measured both on a representative ~13 MB multi-game PGN (high-entropy movetext, so a pessimistic floor):
zstd only wins if cranked to a high level, and even then by ~20% — while
.zipis double-clickable on every OS. For a backup artifact, native openability beats a modest size edge, so we default to zip. Bothzipandzstdwere already dependencies (zip is used on the import side).Notes
.pgn.zipbackup re-imports through the importer's existing zip reader (a single.pgnentry inside).Stringfirst (incidental memory win; the row load itself is still Importer: stream large PGN imports instead of loading the whole file in memory #95's concern).cargo test -p chess-db(14 passed) andcargo clippy -- -D warningsclean; client builds.🤖 Generated with Claude Code