From eb260c132a5e318be19bba82e2bd23cb72e67bfb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 22 Mar 2023 08:59:36 +0100 Subject: [PATCH] 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 --- .../qcryptographichash/tst_bench_qcryptographichash.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp b/tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp index 2127298f59..8066650b32 100644 --- a/tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp +++ b/tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp @@ -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(); } }