Return gas mix from model

Robert Helling helling at atdotde.de
Tue Oct 17 13:32:22 PDT 2017


Linus,

> On 17. Oct 2017, at 22:27, Linus Torvalds <torvalds at linux-foundation.org> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20171017/02a380c0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 529 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20171017/02a380c0/attachment-0001.sig>


More information about the subsurface mailing list