From f446c5c356f3f805e988eef41edb4acbdb2fb5fc Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 25 Feb 2010 11:33:31 +0100 Subject: Add benchmarks for accessing meta-object properties via QScriptValue Reviewed-by: Benjamin Poulain --- .../script/qscriptvalue/tst_qscriptvalue.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp index 3bfc21c..d7bb04b 100644 --- a/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp @@ -69,6 +69,8 @@ private slots: void property(); void setProperty(); void propertyFlags(); + void readMetaProperty(); + void writeMetaProperty(); }; tst_QScriptValue::tst_QScriptValue() @@ -201,5 +203,28 @@ void tst_QScriptValue::propertyFlags() } } +void tst_QScriptValue::readMetaProperty() +{ + QScriptEngine engine; + QScriptValue object = engine.newQObject(QCoreApplication::instance()); + QScriptString propertyName = engine.toStringHandle("objectName"); + QBENCHMARK { + for (int i = 0; i < 10000; ++i) + object.property(propertyName); + } +} + +void tst_QScriptValue::writeMetaProperty() +{ + QScriptEngine engine; + QScriptValue object = engine.newQObject(QCoreApplication::instance()); + QScriptString propertyName = engine.toStringHandle("objectName"); + QScriptValue value(&engine, "foo"); + QBENCHMARK { + for (int i = 0; i < 10000; ++i) + object.setProperty(propertyName, value); + } +} + QTEST_MAIN(tst_QScriptValue) #include "tst_qscriptvalue.moc" -- cgit v0.12 From 8eaeb1d4415d19a43b20fffe46c2b29fd609bba1 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Thu, 25 Feb 2010 11:54:54 +0100 Subject: Revert changes made in scroll_sys(). The optimization created some glitches. It now works properly but it could be improved performance-wise. Task-number: QTBUG-5926 Task-number: QTBUG-5994 Reviewed-by: Morten Sorvig --- src/gui/kernel/qwidget_mac.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 9e7517f..f78596e 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4475,8 +4475,20 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) } } + // ### Scroll the dirty regions as well, the following is not correct. + QRegion displayRegion = r.isNull() ? dirtyOnWidget : (dirtyOnWidget & r); + const QVector &rects = dirtyOnWidget.rects(); + const QVector::const_iterator end = rects.end(); + QVector::const_iterator it = rects.begin(); + while (it != end) { + const QRect rect = *it; + const NSRect dirtyRect = NSMakeRect(rect.x() + dx, rect.y() + dy, + rect.width(), rect.height()); + [view setNeedsDisplayInRect:dirtyRect]; + ++it; + } + NSSize deltaSize = NSMakeSize(dx, dy); - [view translateRectsNeedingDisplayInRect:scrollRect by:deltaSize]; [view scrollRect:scrollRect by:deltaSize]; [view setNeedsDisplayInRect:deltaXRect]; [view setNeedsDisplayInRect:deltaYRect]; -- cgit v0.12