summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Krause <volker.krause@kdab.com>2016-01-05 13:50:51 +0100
committerVolker Krause <volker.krause@kdab.com>2016-01-05 13:02:45 +0000
commite6e6ff34d120d5f5d8616516bc3b9a1c2782677a (patch)
treec431360d93f74a70f74c4aa53bfa3273c5aee22a
parent5d161319bebfc586f4d3e8f8b2a93bbea52c045a (diff)
Move QTextStream creation out of the loop.
This saves one QObject allocation per line of an obj file (which tend to be quite large), for the QDeviceCloseNotifier in QTextStreamPrivate. Change-Id: Ia5762f497782ee4356c2f807dd02f9ab73eccf70 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/render/io/objloader.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/render/io/objloader.cpp b/src/render/io/objloader.cpp
index 87085c1de..a27ad7f21 100644
--- a/src/render/io/objloader.cpp
+++ b/src/render/io/objloader.cpp
@@ -124,12 +124,13 @@ bool ObjLoader::load(::QIODevice *ioDev, const QString &subMesh)
Q_ASSERT(subMeshMatch.isValid());
QTextStream stream(ioDev);
+ QTextStream lineStream;
while (!stream.atEnd()) {
QString line = stream.readLine();
line = line.simplified();
if (line.length() > 0 && line.at(0) != QChar::fromLatin1('#')) {
- QTextStream lineStream(&line, QIODevice::ReadOnly);
+ lineStream.setString(&line, QIODevice::ReadOnly);
QString token;
lineStream >> token;