[mythtv] Re: [mythtv-commits] mythtv commits

Holger Buchfink avalanche at beyondmonkey.com
Sun Oct 24 02:02:00 UTC 2004

Kenneth Aafl°y wrote:
> I guess a loop that checks every iterator NUMPROGRAMLINES forward for a end() 
> iterator before the parsing takes place will do just fine. In the hope that 
> you didn't start making this patch yet, I've attached my patch. I've changed 
> the atoi/atof to toInt/toFloat as the former is very fragile to invalid data, 
> but the latter are a lot slower (was this the main speed gain?). Anyways, if 
> this get's in the parsing won't even be done if the itemcount doesn't line 
> up, so atoi/atof is probably safe.

I changed it so the iterator is checked on the fly, works out since the null
checking is done anyway. As for speed gain I kept atoi, should be good as
long as it doesn't get any null pointers, I did some benchmarks with the qt

!null + atoi()       4x faster

!null + atof()       5x faster

sprintf(int)         8x faster

QDateTime::time_t() + sprintf     33x faster

QDateTime::time_t() + !null + atoi     20x faster


More information about the mythtv-dev mailing list