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:
Jędrzej Nowacki 2012-03-06 12:04:37 +01:00 committed by Qt by Nokia
parent 484e2923b4
commit 393356f5f6

View File

@ -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();