QDecompressHelper: update the benchmark

After the zip bomb checks were added the benchmark was not
adjusted.

Also move the QByteArray creation outside the loop, to not include
the time it takes to make a heap allocation.

Pick-to: 6.7 6.5
Change-Id: Ia958d497dd27fc61e0084b6f5c11d76886bb24c4
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Mårten Nordheim 2024-01-22 14:36:50 +01:00
parent 392c5fab81
commit 6f2ef2eacb
1 changed files with 2 additions and 1 deletions

View File

@ -51,13 +51,14 @@ void tst_QDecompressHelper::decompress()
file.seek(0);
QDecompressHelper helper;
helper.setEncoding(encoding);
helper.setDecompressedSafetyCheckThreshold(-1);
QVERIFY(helper.isValid());
helper.feed(file.readAll());
qsizetype bytes = 0;
QByteArray out(64 * 1024, Qt::Uninitialized);
while (helper.hasData()) {
QByteArray out(64 * 1024, Qt::Uninitialized);
qsizetype bytesRead = helper.read(out.data(), out.size());
bytes += bytesRead;
}