Skip to content

Commit

Permalink
QDecompressHelper: update the benchmark
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
Morten242 committed May 14, 2024
1 parent 392c5fa commit 6f2ef2e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/benchmarks/network/access/qdecompresshelper/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6f2ef2e

Please sign in to comment.