29 #include <QtWidgets/QTreeView>
44 void signal_slot_benchmark();
45 void signal_slot_benchmark_data();
46 void signal_many_receivers();
47 void signal_many_receivers_data();
48 void qproperty_benchmark_data();
49 void qproperty_benchmark();
50 void dynamic_property_benchmark();
51 void connect_disconnect_benchmark_data();
52 void connect_disconnect_benchmark();
53 void receiver_destroyed_benchmark();
87 const int count = 256 * 1024;
98 void tst_QObject::stdAllocator()
100 allocator<QObjectUsingStandardAllocator>();
107 void tst_QObject::signal_slot_benchmark_data()
109 QTest::addColumn<int>(
"type");
118 void tst_QObject::signal_slot_benchmark()
130 }
else if (
type == 4) {
158 singleObject.
slot0();
160 }
else if (
type == 1) {
164 }
else if (
type == 2) {
168 }
else if (
type == 3) {
172 }
else if (
type == 4 ||
type == 5) {
179 void tst_QObject::signal_many_receivers_data()
181 QTest::addColumn<int>(
"receiverCount");
187 void tst_QObject::signal_many_receivers()
189 QFETCH(
int, receiverCount);
191 std::vector<Object> receivers(receiverCount);
193 for (
Object &receiver : receivers)
201 void tst_QObject::qproperty_benchmark_data()
203 QTest::addColumn<QByteArray>(
"name");
205 for (
int i = 0;
i <
mo->propertyCount(); ++
i) {
212 void tst_QObject::qproperty_benchmark()
215 const char *
p =
name.constData();
219 obj.setProperty(
p,
v);
224 void tst_QObject::dynamic_property_benchmark()
228 obj.setProperty(
"myProperty", 123);
229 (
void)
obj.property(
"myProperty");
230 obj.setProperty(
"myOtherProperty", 123);
231 (
void)
obj.property(
"myOtherProperty");
235 void tst_QObject::connect_disconnect_benchmark_data()
237 QTest::addColumn<int>(
"type");
246 void tst_QObject::connect_disconnect_benchmark()
299 void tst_QObject::receiver_destroyed_benchmark()
310 #include "tst_bench_qobject.moc"
small capitals from c petite p scientific i
[1]
The QByteArray class provides an array of bytes.
The QObject class is the base class of all Qt objects.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
void setObjectName(const QString &name)
QObjectUsingStandardAllocator()
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
The QTreeView class provides a default model/view implementation of a tree view.
The QVariant class acts like a union for the most common Qt data types.
void slot3(const QString &a, const QString &b, const QString &c)
void slot1(const QString &a)
void slot4(const QString &a, const QString &b, const QString &c, const QString &d)
void slot5(const QString &a, const QString &b, const QString &c, const QString &d, const QString &e)
void slot2(const QString &a, const QString &b)
void slot6(const QString &a, const QString &b, const QString &c, const QString &d, const QString &e, const QString &f)
Q_TESTLIB_EXPORT QTestData & newRow(const char *dataTag)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
GLsizei const GLfloat * v
[13]
GLenum GLenum GLsizei count
#define QTEST_MAIN(TestObject)
#define QFETCH(Type, name)
@ SignalsAndSlotsBenchmarkConstant
@ CreationDeletionBenckmarkConstant