Commit 3a1fae1e authored by EXT Arnaud Clère's avatar EXT Arnaud Clère
Browse files

Fixed QDataStream QString's utf8 to utf16 and unfair benchmarks

parent 37429af5
......@@ -67,6 +67,7 @@ protected:
bool _record (quint32* cols=nullptr) { Q_UNUSED(cols) ; return true; }
bool _null ( ) { return true; }
bool _bind ( const char* s) { *io << s; return true; }
bool _bind ( QString& s) { *io << s; return true; }
bool _bind ( bool& b) { *io << b; return true; }
bool _bind ( float& f) { *io << f; return true; }
bool _bind ( double& d) { *io << d; return true; }
......@@ -84,6 +85,7 @@ private:
QDataStream* io;
};
template<> struct BindSupport<DataStreamWriter,const char*> : BindNative {};
template<> struct BindSupport<DataStreamWriter, QString&> : BindNative {};
template<> struct BindSupport<DataStreamWriter, bool&> : BindNative {};
template<> struct BindSupport<DataStreamWriter, float&> : BindNative {};
template<> struct BindSupport<DataStreamWriter, double&> : BindNative {};
......
......@@ -247,9 +247,8 @@ int main()
START {
b.seek(0); b.buffer().clear();
QDataStream data(&b);
data << '[';
for (int i=0; i < 16; i++) {
data << ' ' << transform[i];
data << transform[i];
};
}
STOP("QDataStream",QString::fromUtf8(b.buffer().toHex()));
......@@ -299,13 +298,12 @@ int main()
{
START {
b.seek(0); b.buffer().clear();
QDataStream(&b) << '['
<< ' ' << person.firstName.constData()
<< ' ' << person. lastName.constData()
<< ' ' << person. height
<< ' ' << person. age
<< ' ' << person. phones
<< ']'
QDataStream(&b)
<< person.firstName.constData()
<< person. lastName.constData()
<< person. height
<< person. age
<< person. phones
;
}
STOP("QDataStream",QString::fromUtf8(b.buffer().toHex()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment