QTime: optimize toString()
Instead of using a QString::arg() cascade, which creates tons of temporaries, use good 'ol sprintf(). Effects on Linux GCC 4.9 stripped release builds: text -308B data +-0B relocs +-0 Change-Id: I348577491d1399b5040f7ed9e9f6b111a9528e5d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
1e824bb9c4
commit
aab749487f
|
|
@ -1569,9 +1569,7 @@ QString QTime::toString(Qt::DateFormat format) const
|
|||
case Qt::ISODate:
|
||||
case Qt::TextDate:
|
||||
default:
|
||||
return QString::fromLatin1("%1:%2:%3").arg(hour(), 2, 10, QLatin1Char('0'))
|
||||
.arg(minute(), 2, 10, QLatin1Char('0'))
|
||||
.arg(second(), 2, 10, QLatin1Char('0'));
|
||||
return QString::asprintf("%02d:%02d:%02d", hour(), minute(), second());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue