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

Linus Torvalds torvalds at linux-foundation.org
Sun Jan 19 13:22:25 UTC 2014


On Sun, Jan 19, 2014 at 1:03 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> The second patch has that "simplify calculate_deco_information" part
> in it too (in *addition* to the 60s TTS interval change that is in the
> first one).

Actually, that second patch is slightly buggy, although it's probably
worth testing anyway. The bug is that if there are two plot_data
entries with the same timestamp (which can apparently happen under
some broken cases), it won't update all the ceiling information for
the second one. I don't think it matters for your testing, but I
thought I'd mention it so that Dirk doesn't try to aggressively apply
those test-patches.

Dirk - making the TTS calculations use a one-minute 'time_stepsize'
makes sense regardless. And that's the big performance win - the whole
TTS thing is O(n**2) because it does the deco calculations for each
sample point, and then *within* each sample point it then goes forward
to try to see how much TTS. Making the time_stepsize bigger makes that
inner loop that much faster, so it should cut down TTS calculations by
a factor of six, with no real downside (we report TTS in one-minute
increments anyway, so calculating them to 10s intervals seems silly).

                        Linus


More information about the subsurface mailing list