Linus, > On 17. Oct 2017, at 22:27, Linus Torvalds <[email protected]> > wrote: > >> >> the problem I see is that we need that information in the diveProfileItem >> which gets its data from the divePlotDataModel. And that has random access >> not sequential (at least in theory). > > You can do random access without the loop by just doing > >> struct gasmix *gasmix = NULL; >> struct event *ev = NULL; >> gasmix = get_gasmix(dive, dc, time, &ev, gasmix); > > the loop is just the efficient model when you do it over and over again. > > Please don't add pointless redundancy.
But that means we loop over all (actually half on average) events every time we need that value (i.e. once per plot_item). Don’t you think the computational cost of that is worth computing this once (with the loop you mentioned) where we have to do it anyway and then simply do a lookup? I.e. you really want to save two ints per plotitem at the expense of looping over events (note that we need that info also for example when computing MOD etc, so the loop is not only once per plot. Best Robert
signature.asc
Description: Message signed with OpenPGP
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
