diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-26 11:57:29 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-26 12:00:42 (GMT) |
commit | e9ffb5b0918e800edfba6b697c7a14ef6c7fa8e1 (patch) | |
tree | 7d5f7c4995655b141dcb6a393647eef4a0449fda /tests/benchmarks/qscriptvalue | |
parent | de3939532af08c37e709d1bae8cf50a57d6f63be (diff) | |
download | Qt-e9ffb5b0918e800edfba6b697c7a14ef6c7fa8e1.zip Qt-e9ffb5b0918e800edfba6b697c7a14ef6c7fa8e1.tar.gz Qt-e9ffb5b0918e800edfba6b697c7a14ef6c7fa8e1.tar.bz2 |
fix performance issue with QScriptValue::propertyFlags()
Calling QScriptEngine::toStringHandle() is dead slow, so don't call it;
use JSC::Identifier directly.
This is the same issue as was fixed for setProperty() in commit
a8574172dd5e6bc11cf6f69b6fad5a063549e88d.
Diffstat (limited to 'tests/benchmarks/qscriptvalue')
-rw-r--r-- | tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp b/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp index 904674e..b637591 100644 --- a/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp @@ -68,6 +68,7 @@ private slots: void toQObject(); void property(); void setProperty(); + void propertyFlags(); }; tst_QScriptValue::tst_QScriptValue() @@ -189,5 +190,16 @@ void tst_QScriptValue::setProperty() } } +void tst_QScriptValue::propertyFlags() +{ + QScriptEngine engine; + QScriptValue obj = engine.newObject(); + QString propertyName = QString::fromLatin1("foo"); + obj.setProperty(propertyName, 123, QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly); + QBENCHMARK { + (void)obj.propertyFlags(propertyName); + } +} + QTEST_MAIN(tst_QScriptValue) #include "tst_qscriptvalue.moc" |