[PATCH] Stop doing the (very expensive) pow() calculation pointlessly

Linus Torvalds torvalds at linux-foundation.org
Wed Jan 22 10:31:30 UTC 2014


On Wed, Jan 22, 2014 at 8:25 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> What I think would be the right thing to do is similar to what I think
> most dive computers do as well:
>
> Calculate a constant rate ascent until we would actually cross above the
> ceiling (so not, "ascend from where we are NOW to the ceiling for NOW",
> but instead "ascend until by going up another 3m/10ft we would violate
> the then current ceiling"). Then wait in increments of full minutes
> until we can ascend to the next 3m/10ft potential stop (using the same
> logic as above).

That is very close to what we do now, with the addition of the
1-minute stop granularity (which is what my one-liner patch did).

But your "go up another 3m" is ambiguous. Do you mean "go up 3m from
where we are now" (which is *not* what the code does now) or do you
mean "go up to the next 3m boundary" (which is pretty much exactly
what the code does now.

So if you mean "go up to the next 3m boundary, but then stop for whole
minutes", then that is literally exactly what changing time_stepsize
from 10 to 60 would do.

Side note: adding Anton explicitly to the Cc, to see if he has
comments and might not have noticed the mailing list thread. He's the
original author of the code in question. Anton - mind checking my
commentary on the TTS algorithm in my previous mail in the thread? I
might have missed something..

              Linus


More information about the subsurface mailing list