diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-20 16:25:32 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-21 11:37:21 (GMT) |
commit | f5f89d34fa98600a95c4b1b8b62bd794ab8c8e3b (patch) | |
tree | 97a25ac3377c7e2dc0aa43e38daac81c59b7aa44 /tests | |
parent | 4aa4111864df9e8a7917b021d6e31214e8c7a0bd (diff) | |
download | Qt-f5f89d34fa98600a95c4b1b8b62bd794ab8c8e3b.zip Qt-f5f89d34fa98600a95c4b1b8b62bd794ab8c8e3b.tar.gz Qt-f5f89d34fa98600a95c4b1b8b62bd794ab8c8e3b.tar.bz2 |
Optimize contrcuction of variant of type pointer.
Constructing a variant of a pointer type was previously quite slow:
QVariant had no information it was a pointer. It had to create a
QVariant::PrivateShared, ask the QMetaType for a constructor (slow as it
involve locking mutextes) and allocate a pointer.
By detecting a pointer in qVariantFromValue, we can store the pointer
value dirrectly in the Variant union. We then avoid 2 allocations,
and the expensive locking in QMetaType::construct
Reviewed-by: Thierry
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qvariant/tst_qvariant.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 709cba9..1722ad3 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -2747,6 +2747,7 @@ void tst_QVariant::dataStar() const v2 = qVariantFromValue(p1); QVERIFY(v1 == v2); + delete p1; } void tst_QVariant::canConvertQStringList() const |