xournalpp / xournalpp

Xournal++ is a handwriting notetaking software with PDF annotation support. Written in C++ with GTK3, supporting Linux (e.g. Ubuntu, Debian, Arch, SUSE), macOS and Windows 10. Supports pen input from devices such as Wacom Tablets.
https://xournalpp.github.io
GNU General Public License v2.0
11.25k stars 803 forks source link

Implementation of checksum to reduce saving time #2130

Open lpinilla opened 4 years ago

lpinilla commented 4 years ago

The "problem" After making some drawings on one or more pages (enough to see the loading bar filling), I save my work several times without adding new strokes and it takes the same amount of time to save the file each time, which leads me to think that some optimization can take place.

The solution Each page could have a tag/checksum to store the information of the pages (let's say for example number of strokes) so if that value hasn't change, it means that page (and later the entire file) hasn't been changed so the save function can safely do nothing if called multiple times.

Easier alternatives An easier alternative would be to have a boolean array which would indicate if a page "has_been_modified" since last save. Although this wouldn't work when opening a file, it should work on the 2nd save of the user if it didn't make any changes (1st save will be a "full save" and for the 2nd save the array can take participation).

Comments I'm sorry if this is already implemented or if it is a duplicate, I've tried searching for "checksum" on both the issues or grepping the source but I didn't find anything.

Cheers.

rolandlo commented 4 years ago

I don't think this is already implemented. It sounds like an interesting suggestion to me. A different suggestion to reduce saving time has been made in #1869.

lpinilla commented 4 years ago

I saw the issue linked and I think they can greatly complement each other. Saving when it really needs to and reducing the saving time itself.