summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-08-12 20:10:57 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-08-12 20:32:24 (GMT)
commit88c6dc6ec7f73de279703b30874b30511901854b (patch)
tree15d1b87a2f10bbaf9d8e08a8bee75de9ed71afe6 /tests/benchmarks
parent18e548c3f705fa6b4ebfac80fe79fe49dac54a0a (diff)
downloadQt-88c6dc6ec7f73de279703b30874b30511901854b.zip
Qt-88c6dc6ec7f73de279703b30874b30511901854b.tar.gz
Qt-88c6dc6ec7f73de279703b30874b30511901854b.tar.bz2
Make simple function getters inline
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/qscriptengine/tst_qscriptengine.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
index 81dedfa..515285d 100644
--- a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
@@ -69,6 +69,7 @@ private slots:
void pushAndPopContext();
void toStringHandle();
void castValueToQreal();
+ void nativeCall();
};
tst_QScriptEngine::tst_QScriptEngine()
@@ -225,5 +226,21 @@ void tst_QScriptEngine::castValueToQreal()
}
}
+static QScriptValue native_function(QScriptContext *, QScriptEngine *)
+{
+ return 42;
+}
+
+void tst_QScriptEngine::nativeCall()
+{
+ QScriptEngine eng;
+ eng.globalObject().setProperty("fun", eng.newFunction(native_function));
+ QBENCHMARK{
+ eng.evaluate("var w = 0; for (i = 0; i < 100000; ++i) {\n"
+ " w += fun() + fun(); w -= fun(); fun(); w -= fun(); }");
+ }
+}
+
+
QTEST_MAIN(tst_QScriptEngine)
#include "tst_qscriptengine.moc"