MCPcopy Create free account
hub / github.com/KDE/kdevelop / bench_hashString

Method bench_hashString

kdevplatform/serialization/tests/bench_indexedstring.cpp:118–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118void BenchIndexedString::bench_hashString()
119{
120 const QVector<QString> strings = generateData();
121 QVector<QByteArray> byteArrays;
122 byteArrays.reserve(strings.size());
123 for (const auto& string : strings) {
124 byteArrays << string.toUtf8();
125 }
126
127 quint64 sum = 0;
128 QBENCHMARK {
129 for (const auto& array : std::as_const(byteArrays)) {
130 sum += IndexedString::hashString(array.constData(), array.length());
131 }
132 }
133 QVERIFY(sum > 0);
134}
135
136void BenchIndexedString::bench_kdevhash()
137{

Callers

nothing calls this directly

Calls 4

generateDataFunction · 0.70
reserveMethod · 0.45
sizeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected