diff options
author | David Skoland <david.skoland@qt.io> | 2021-04-26 12:22:05 +0200 |
---|---|---|
committer | David Skoland <david.skoland@qt.io> | 2021-04-27 15:34:50 +0200 |
commit | fea8ed0dcbff5d6adefc4db43a2e4f8563d8553b (patch) | |
tree | 7b996a39b07ba146ab0ab588f2c467eb364e5763 /tests/benchmarks/corelib | |
parent | 5acb1af6b6c714665a54024b2f14fa5ec63ca237 (diff) |
Make loop variables references in date benchmark
This more accurately simulates real-world usage.
Change-Id: Ib1b49d165b3cfaef2bef51e958a1830cc7f8c285
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/benchmarks/corelib')
-rw-r--r-- | tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp | 10 |
1 files 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); |