View difference between Paste ID: hKpxs8dt and VAbdBBuA
SHOW: | | - or go back to the newest paste.
1
const QByteArray SEP = ": ";
2
const QByteArray NEWLINE = "\r\n";
3
4
QMap<QString, QString> m_Values;
5
6
void QAmiPropertyMap::convertStr(const QByteArray &str)
7
{    
8
    QStringList lines = QString(str).split(NEWLINE);
9
    for(const auto &s : lines) {
10
        int cutAt = s.indexOf(SEP);
11-
        QString key = s.left(cutAt);
11+
        QStringRef key = s.leftRef(cutAt);
12-
        QString value = s.right(s.length() - cutAt - SEP.length());
12+
        QStringRef value = s.rightRef(s.length() - cutAt - SEP.length());
13
        //qDebug() << "KEY: "<< key << " VALUE: "<<value;
14-
        m_Values.insert(key, value);
14+
        m_Values.insert(*key.string(), *value.string());
15
    }
16
}
17
18-
Elapsed time:	 552 ms
18+
Elapsed time:	 427 ms
19-
One cycle:	 1.840000 ms
19+
One cycle:	 1.423333 ms
20-
Create item:	 0.008519 ms
20+
Create item:	 0.006590 ms
21
Items: 		216
22
Create count (300x216): 64800