Don't write back dive data that hasn't changed in git

This caches the git ID for the dive on load, and avoids building the
dive directory and hashing it on save as long as nothing has invalidated
the git ID cache.

That should make it much faster to write back data to the git
repository, since the dive tree structure and the divecomputer blobs in
particular are the bulk of it (due to all the sample data).  It's not
actually the git operations that are all that expensive, it's literally
generating the big blob with all the snprintf() calls for the data.

The git save used to be a fairly expensive with large data sets,
especially noticeable on mobile with much weaker CPU's.  This should
speed things up by at least a factor of two.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2016-04-03 17:31:59 -05:00 committed by Dirk Hohndel
parent 2b36091599
commit 2d760a7bff
8 changed files with 77 additions and 16 deletions

View file

@ -1049,8 +1049,10 @@ void MainTab::acceptChanges()
// each dive that was selected might have had the temperatures in its active divecomputer changed
// so re-populate the temperatures - easiest way to do this is by calling fixup_dive
for_each_dive (i, d) {
if (d->selected)
if (d->selected) {
fixup_dive(d);
invalidate_dive_cache(d);
}
}
}
if (editMode != TRIP && current_dive->divetrip) {