Creating benchmarks
We have learned about benchmarking in Chapter 9, Testing and Debugging. Let's look at some aspects of benchmarking to evaluate performance issues. We've already talked about Qt Test's support for benchmarking, which is a calculation of the average time required by a particular task. The QBENCHMARK
macro is used to benchmark a function.
The following code snippet shows benchmarking key clicks on a line edit:
void LineEditTest::testClicks() {     auto tstLineEdit = ui->lineEdit;     QBENCHMARK {QTest::keyClicks(tstLineEdit, "Some                 Inputs");} }
You can also benchmark convenience functions provided by Qt. The following code benchmarks the QString::localeAwareCompare()
function. Let's look at the sample code here:
void TestQStringBenchmark::simpleBenchmark() { Â Â Â Â QString...