This is a series of four pretty simple patches that get rid of some insane
code in the cylinder pressure interpolation logic.
The insane code seems to have grown over time, as the code was updated and
made to handle different cases without ever looking at how that changed
the rules. It all probably made sense at some point.
The nasty code not only looked quite incomprehensible, with random odd
rules that made no sense, it also resulted in the algorithm being O(n**2)
in the number of plot entries. Normally that's not a huge issue, because
the calculations themselves were simple, and there generally aren't *that*
many plot entries.
But at some point even just a simple O(n**2) gets expensive when you have
long dives and have set your dive computer to do samples every 2
seconds...
The fix is fairly simple in the end, but to make it all easier to
understand I split it up into four patches. That makes the surgery on some
very confusing code be much simpler to follow along, and hopefully makes
people go "ok, that's obviously and trivially correct" for each step.
Still, despite how obvious and trivially correct this series is, people
should double-check. It speeds up the example case by quite a bit, to the
point where other expenses in plotting long dives with lots of samples
dominates. And I did check it on a few dives I have with multiple
cylinders, but some more testing certainly can't hurt.
Actual patches will come as replies to this email.
Linus
Linus Torvalds (4):
pressure interpolation: get rid of pointless and confusing code
pressure interpolation: simplify code
pressure interpolation: further code simplification
pressure interpolation: incrementally update interpolation data
subsurface-core/gaspressures.c | 48 +++++++++++++-----------------------------
1 file changed, 15 insertions(+), 33 deletions(-)
--
2.7.0.170.ge572fef
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface