QBENCHMARK: mark loop operations as noexcept
Tell the compiler that next() and isDone() cannot throw, so it doesn't need to create exception handling code. This might yield more faithful benchmark results for micro-benchmarks. As a drive-by, mark isDone() as const, too. Change-Id: Ifac3d9ee2f4df524e780fd07423e26bb5e87dab3 Reviewed-by: Jason McDonald <macadder1@gmail.com> Reviewed-by: Isak Fyksen <isak.fyksen@qt.io>bb10
parent
6017695bfa
commit
b08ba96fd0
|
|
@ -167,7 +167,7 @@ QTest::QBenchmarkIterationController::~QBenchmarkIterationController()
|
|||
|
||||
/*! \internal
|
||||
*/
|
||||
bool QTest::QBenchmarkIterationController::isDone()
|
||||
bool QTest::QBenchmarkIterationController::isDone() const noexcept
|
||||
{
|
||||
if (QBenchmarkTestMethodData::current->runOnce)
|
||||
return i > 0;
|
||||
|
|
@ -176,14 +176,14 @@ bool QTest::QBenchmarkIterationController::isDone()
|
|||
|
||||
/*! \internal
|
||||
*/
|
||||
void QTest::QBenchmarkIterationController::next()
|
||||
void QTest::QBenchmarkIterationController::next() noexcept
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
*/
|
||||
int QTest::iterationCount()
|
||||
int QTest::iterationCount() noexcept
|
||||
{
|
||||
return QBenchmarkTestMethodData::current->iterationCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ public:
|
|||
QBenchmarkIterationController();
|
||||
QBenchmarkIterationController(RunMode runMode);
|
||||
~QBenchmarkIterationController();
|
||||
bool isDone();
|
||||
void next();
|
||||
bool isDone() const noexcept;
|
||||
void next() noexcept;
|
||||
int i;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ public:
|
|||
// low-level API:
|
||||
namespace QTest
|
||||
{
|
||||
int iterationCount();
|
||||
int iterationCount() noexcept;
|
||||
void setIterationCountHint(int count);
|
||||
void setIterationCount(int count);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue