QDateTime: prevent aggressive inlining
The function getDateFromJulianDay() is simple arithmetic, but still ~400 bytes in executable size. Yet GCC inlines this everywhere I looked, which makes some sense, as different users of the class only use parts of the return value and the optimizer has a field day removing all that dead code. However, that function has only one conditional, so presumably it executes at full pipeline speed and it doesn't matter that it calculates too much in some cases. More important is to use the I-cache more conservatively. That's what not inlining the function achieves. The function returns its result in registers and doesn't spill registers when called (at least on AMD64), so the effect on runtime should be negligible. Effects on Linux GCC 4.9 stripped release builds: text -1536B data +-0B relocs +-0 Change-Id: Ia16838102d29ad67ee5efdc8b7b0a26f2f921df1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
aab749487f
commit
2450a66001
@ -122,6 +122,8 @@ struct ParsedDate
|
||||
int year, month, day;
|
||||
};
|
||||
|
||||
// prevent this function from being inlined into all 10 users
|
||||
Q_NEVER_INLINE
|
||||
static ParsedDate getDateFromJulianDay(qint64 julianDay)
|
||||
{
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user