Add benchmark for QMetaType::create().
A case of a custom type creation was not covered before. Change-Id: Icd2a7d63633f8e40d9d4a8a26e0eb0896fc85ec8 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
This commit is contained in:
parent
484e2923b4
commit
393356f5f6
@ -77,6 +77,9 @@ private slots:
|
||||
void constructCoreTypeCopy_data();
|
||||
void constructCoreTypeCopy();
|
||||
|
||||
void constructCustomType_data();
|
||||
void constructCustomType();
|
||||
|
||||
void constructInPlace_data();
|
||||
void constructInPlace();
|
||||
void constructInPlaceCopy_data();
|
||||
@ -309,6 +312,24 @@ void tst_QMetaType::constructCoreTypeCopy()
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QMetaType::constructCustomType_data()
|
||||
{
|
||||
QTest::addColumn<int>("typeId");
|
||||
|
||||
QTest::newRow("BigClass") << qMetaTypeId<BigClass>();
|
||||
}
|
||||
|
||||
void tst_QMetaType::constructCustomType()
|
||||
{
|
||||
QFETCH(int, typeId);
|
||||
QBENCHMARK {
|
||||
for (int i = 0; i < 100000; ++i) {
|
||||
void *data = QMetaType::create(typeId, (void *)0);
|
||||
QMetaType::destroy(typeId, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QMetaType::constructInPlace_data()
|
||||
{
|
||||
constructCoreType_data();
|
||||
|
Loading…
Reference in New Issue
Block a user