[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
stuff:

QString::toInt()
!null + atoi()       4x faster

QString::toFloat()
!null + atof()       5x faster

QString::number(int)
sprintf(int)         8x faster

QDateTime::toString(QT::ISODate)
QDateTime::time_t() + sprintf     33x faster

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


Holger


More information about the mythtv-dev mailing list