CPU hogging in the current master

Dirk Hohndel dirk at hohndel.org
Tue Sep 24 03:25:39 UTC 2013


On Tue, 2013-09-24 at 13:04 +0300, Lubomir I. Ivanov wrote:
> i've noticed that particular dives in the Qt divelist make the
> application non-responsive for n seconds.
> 
> test case for a couple of builds - Qt (master) and GTK (binary from
> 12.may.2013):
> - disable all extra profile plot settings
> - import all test dives
> - select dive #20 (20th test dive...)
> - measure render time, roughly
> 
> with this old GTK build it takes milliseconds, with Qt it takes >5 seconds.
> 
> after some testing i've narrowed down the cause to be in the "backend"...
> profile.c: calculate_deco_information()
> while(next_stop >= 0) {
> ...
> 
> where 'next_stop' seems to update thousand of times between 3000 and 0
> for this dive.

This is the TTS (time to surface) calculation - and reading the code I'm
a bit confused by what it is trying to do.

> it seems that this portion of code was written by Anton Lundin in
> july, so i've CCed him in this email.
> 
> git blame profile.c -L 1091,1107
> 35356e36 (Anton Lundin 2013-07-05 15:19:41 +0200 1091)
> 
> could this algorithm be somehow improved?

Clearly July wasn't my best month as maintainer... I should have
scrutinized this a bit more...

Let's see what Anton has to say, otherwise I can look at reimplementing
this. It should be pretty easy to simply cache the values instead of
constantly walking forward and backward.

/D



More information about the subsurface mailing list