-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
New rnote file format, better compression and serialization, atomic file saving #1177
Open
anesthetice
wants to merge
32
commits into
flxzt:main
Choose a base branch
from
anesthetice:file
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,078
−166
Conversation
This file contains 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
…el meanwhile the ComM isn't None as well
anesthetice
changed the title
More versatile rnote file format, issue 1173
New rnote file format, better compression and serialization, atomic file saving
Aug 25, 2024
… into_bytes, is not worth it at all
demo 1 - backwards compatibility, size ratio, persistent compression levelrnote_demo_1.mp4demo 2 - rnote-cli mutate (atomic file saving is also noticeable)rnote_demo_2.mp4 |
…as it is only used for debug purposes
I went through all of my code yesterday, I'd say this is ready for review, still open to suggestions or improvements of course |
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.
I've extended this pull request with #1150 to share code in common, and #1170 as they were in conflict.
The overall goal of this PR is to improve the handling of Rnote save files, this is accomplished mainly in three ways:
(fixes New file format (stabilization) #1173)
(fixes More resilient file saving by a two-stage file save process #1128)
1 - the Rnote file format
With regards to what was discussed on this issue here #1173:
backwards compatible
this format supports (and can be extended to support)
the file's version and metadata are kept separate from the (potentially) compressed data
still unsure as to how well this new format would support partial file loading, but I believe it could be possible by adding extra header info (such as an array containing the start of each sub-bloc in the body of the file)
2 - compression and serialization
See https://github.com/anesthetice/rnote-compression-benchmarking
In addition to the default compression and serialization method changes, users can also select their desired compression level, from "Very Low" to "Very High" in the "Document" section of the settings, Rnote re-uses the previously selected compression level for new files, and as for existent files, maintains their compression level unless explicitly changed by the user.
For debugging purposes, the serialization and compression methods can be set to non-standard variants, and can be maintained even after re-saving the file by setting method_lock to true
These features are achieved by using save preferences (EngineSnapshot <-> Engine <-> EngineConfig)
3 - atomic saves
Current
Propsal:
4 - other cool stuff
rnote-cli mutate
Ever wanted to further compress Rnote files you don't often use but still wish to have direct access to?
rnote-cli mutate --compression-method zstd --compression-level 19 --serialization-method bitcode $(find . -name "*.rnote" 2>/dev/null)
Want an uncompressed Rnote file encoded in json?
rnote-cli mutate --compression-method none --serialization-method json --lock file.rnote
5 - pinboard
Deserialized from Json in 0.822; Serialized to 46.201438 MB, in 0.518
Deserialized from Cbor in 0.229; Serialized to 39.910991 MB, in 0.073
Deserialized from Bincode in 0.027; Serialized to 20.993607 MB, in 0.016
Deserialized from Toml in 5.255; Serialized to 112.392787 MB, in 7.203
Deserialized from Bitcode in 0.020; Serialized to 17.432074 MB, in 0.028
Deserialized from Pot in 0.120; Serialized to 28.007348 MB, in 0.049
Deserialized from Postcard in 0.017; Serialized to 18.668699 MB, in 0.017