fundamental design issues with trips and dives

Linus Torvalds torvalds at linux-foundation.org
Thu Nov 7 14:41:55 PST 2019


On Thu, Nov 7, 2019 at 2:25 PM Dirk Hohndel <dirk at hohndel.org> wrote:
>
> > And it might be truly *lovely* for startup if we didn't populate the
> > whole model at all. For the git format, we could literally avoid even
> > parsing the dives that are in a collapsed trip and this not visible.
>
> So we'd have a dive_table that isn't populated? That sounds entertaining.

It won't be trivial. But that's code that I could probably work on,
unlike the UI code.

And it's not practically doable with the XML parse format anyway, so
it would be purely a git load thing. But for the common cloud case, it
shouldn't be too bad.

What I'd do would be to make parse_divecomputer_entry() and
parse_dive_entry() (in load-git.c) not actually load the git object
but just save them off in the 'struct dive' and 'struct divecomputer'.

And then we'd have to have a hook in the place that actually populates
the Qt tables to do a "if (!dive->parsed)
really_parse_dive_and_dive_computer()"

The reason this works with the git format (but not the xml format) is
that the git format makes separate git objects for dives and dive
computers. It's what allows us to effectively do this same
optimization in reverse when we save the state (and it is why we
actually already have the git object ID in the 'struct dive' structure
- but we'd have to add it to the 'struct divecomputer' one too).

No, it wouldn't be trivial. But it also doesn't look horribly hard -
if we have the hook for "now this dive is going to be exposed in the
Qt dive list structures"

Famous last words.

And NOTE! This would only work for dives that are literally hidden by
the fact that the dive is in a trip, and the trips start out collapsed
at startup. Again, that's the _common_ case, but on the desktop, when
you sort by any other value than the dive number, that obviously then
exposes everything.

Similarly, we'd have to have some kind of "now load everything" before
things like search filters and statistics are shown. So it's not
_just_ the whole "now dive got exposed in the Qt lists", but I think
it could be limited to a fairly few places.

So note that we'd actually have the 'struct dive' etc all allocated,
but nothing would be filled in (we could fill in the date based on the
git name of the dive, but even that isn't necessary - we do save the
trip date in the git repo separately, so we'd get trip sorting that
way).

           Linus


More information about the subsurface mailing list