aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2014-12-19 20:35:53 +0100
committerRobin Burchell <robin.burchell@viroteck.net>2014-12-19 21:52:54 +0100
commit9b43867c06ed56ff3c636892af43013842ea12a1 (patch)
tree38aa1403df7c9779c93f671d5ab91e83287f4f8d /src/qml/parser
parent05bf96997c52775f14cfd4e34d25187feec897e0 (diff)
QQmlJS::Lexer::scanNumber: Use a QVarLengthArray to avoid heap allocations.
This shaved the time of this function in half on an (admittedly very morbid) testcase of mine, from 161ms to 72ms total. Change-Id: I88ad8d4ad4791dc4e7eadb9af9265ff02fe5376f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/parser')
-rw-r--r--src/qml/parser/qqmljslexer.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/qml/parser/qqmljslexer.cpp b/src/qml/parser/qqmljslexer.cpp
index 416a6ee745..2e2a4e5f8b 100644
--- a/src/qml/parser/qqmljslexer.cpp
+++ b/src/qml/parser/qqmljslexer.cpp
@@ -887,8 +887,7 @@ again:
int Lexer::scanNumber(QChar ch)
{
if (ch != QLatin1Char('0')) {
- QByteArray buf;
- buf.reserve(64);
+ QVarLengthArray<char, 64> buf;
buf += ch.toLatin1();
QChar n = _char;