From fea8ed0dcbff5d6adefc4db43a2e4f8563d8553b Mon Sep 17 00:00:00 2001 From: David Skoland Date: Mon, 26 Apr 2021 12:22:05 +0200 Subject: [PATCH] Make loop variables references in date benchmark This more accurately simulates real-world usage. Change-Id: Ib1b49d165b3cfaef2bef51e958a1830cc7f8c285 Reviewed-by: Volker Hilsheimer Reviewed-by: Edward Welbourne --- .../benchmarks/corelib/time/qdate/tst_bench_qdate.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp b/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp index f8ca632beb..196289148a 100644 --- a/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp +++ b/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp @@ -149,7 +149,7 @@ void tst_QDate::daysInYear() { const auto list = yearly(1601, 2401); QBENCHMARK { - for (const QDate date : list) + for (const QDate &date : list) date.daysInYear(); } } @@ -167,7 +167,7 @@ void tst_QDate::getSetDate() QDate store; const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020); QBENCHMARK { - for (const auto test : list) { + for (const auto &test : list) { int year, month, day; test.getDate(&year, &month, &day); store.setDate(year, month, day); @@ -181,7 +181,7 @@ void tst_QDate::addDays() QDate store; const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020); QBENCHMARK { - for (const auto test : list) + for (const auto &test : list) store = test.addDays(17); } Q_UNUSED(store); @@ -192,7 +192,7 @@ void tst_QDate::addMonths() QDate store; const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020); QBENCHMARK { - for (const auto test : list) + for (const auto &test : list) store = test.addMonths(17); } Q_UNUSED(store); @@ -203,7 +203,7 @@ void tst_QDate::addYears() QDate store; const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020); QBENCHMARK { - for (const auto test : list) + for (const auto &test : list) store = test.addYears(17); } Q_UNUSED(store);