Darwin: Disable QMacAutoReleasePool tracker in release builds
It adds overhead that is noticeable, especially in tight loops that rely on an auto-release pool. For example, this improves the QLocale date to string transformations an order of a magnitude. Task-number: QTBUG-104785 Pick-to: 6.5 Change-Id: I246dc4e114bd75dd4e3e9e42b061c4c20c94d522 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>bb10
parent
e95f03f989
commit
59c686080d
|
|
@ -214,21 +214,24 @@ QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_DECLARE_WEAK_QDEBUG_OPERATOR_FOR_CF_TY
|
|||
|
||||
QT_END_NAMESPACE
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
@interface QT_MANGLE_NAMESPACE(QMacAutoReleasePoolTracker) : NSObject
|
||||
@end
|
||||
|
||||
@implementation QT_MANGLE_NAMESPACE(QMacAutoReleasePoolTracker)
|
||||
@end
|
||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(QMacAutoReleasePoolTracker);
|
||||
#endif // QT_DEBUG
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QMacAutoReleasePool::QMacAutoReleasePool()
|
||||
: pool([[NSAutoreleasePool alloc] init])
|
||||
{
|
||||
#ifdef QT_DEBUG
|
||||
Class trackerClass = [QMacAutoReleasePoolTracker class];
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
void *poolFrame = nullptr;
|
||||
void *frames[2];
|
||||
if (backtrace_from_fp(__builtin_frame_address(0), frames, 2))
|
||||
|
|
@ -258,9 +261,9 @@ QMacAutoReleasePool::QMacAutoReleasePool()
|
|||
free((char*)symbolName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[[trackerClass new] autorelease];
|
||||
#endif // QT_DEBUG
|
||||
}
|
||||
|
||||
QMacAutoReleasePool::~QMacAutoReleasePool()
|
||||
|
|
|
|||
Loading…
Reference in New Issue