tst_bench_QCryptographicHash: use resultView()

Don't benchmark the creation of the QByteArray from the internal
buffer, that's not interesting.

Call resultView() instead of result().

On the one hand, this skews comparisons with older benchmark data.

OTOH, result() used to be the fastest way to get the result out of
QCryptographicHash or QMessageAuthenticationCode, and now it's
resultView(), so in a way, it still is a fair comparison.

Pick-to: 6.5
Change-Id: I864b2f88f01e426c5d0967f57199e13dd7cb29f8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Marc Mutz 2023-03-22 08:59:36 +01:00
parent 0eccfe5e39
commit eb260c132a

View File

@ -117,7 +117,7 @@ void tst_QCryptographicHash::addData()
hash.reset();
hash.addData(data);
[[maybe_unused]]
auto r = hash.result();
auto r = hash.resultView();
}
}
@ -138,7 +138,7 @@ void tst_QCryptographicHash::addDataChunked()
hash.addData({data.constData() + data.size() / 64 * 64, data.size() % 64});
[[maybe_unused]]
auto r = hash.result();
auto r = hash.resultView();
}
}
@ -178,7 +178,7 @@ void tst_QCryptographicHash::hmac_addData()
mac.reset();
mac.addData(data);
[[maybe_unused]]
auto r = mac.result();
auto r = mac.resultView();
}
}