QDate: optimize QDate::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 -216B data +-0B relocs +-0 Change-Id: I6ff551cb9f42e0c05a64f03a8e177fb527915481 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
8f553484fa
commit
647ad3fe25
@ -888,9 +888,7 @@ QString QDate::toString(Qt::DateFormat format) const
|
||||
pd = getDateFromJulianDay(jd);
|
||||
if (pd.year < 0 || pd.year > 9999)
|
||||
return QString();
|
||||
return QString::fromLatin1("%1-%2-%3").arg(pd.year, 4, 10, QLatin1Char('0'))
|
||||
.arg(pd.month, 2, 10, QLatin1Char('0'))
|
||||
.arg(pd.day, 2, 10, QLatin1Char('0'));
|
||||
return QString::asprintf("%04d-%02d-%02d", pd.year, pd.month, pd.day);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user