diff options
Diffstat (limited to 'tests/benchmarks/corelib/tools/qvector/main.cpp')
-rw-r--r-- | tests/benchmarks/corelib/tools/qvector/main.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/benchmarks/corelib/tools/qvector/main.cpp b/tests/benchmarks/corelib/tools/qvector/main.cpp index 1795f2dc6f..f7325f7998 100644 --- a/tests/benchmarks/corelib/tools/qvector/main.cpp +++ b/tests/benchmarks/corelib/tools/qvector/main.cpp @@ -83,7 +83,7 @@ qvector_const_read_access: xorl %eax, %eax .L183: ! fldl s -! faddl 16(%edx,%eax,8) +! faddl 16(%edx,%eax,8) ! addl $1, %eax ! cmpl $10000, %eax ! fstpl s @@ -206,6 +206,7 @@ private slots: void qvector_separator() { qWarning() << "QVector results: "; } void qvector_const_read_access(); void qvector_mutable_read_access(); + void qvector_pop_back(); #ifdef TEST_RETURN void qvector_fill_and_return(); #endif @@ -214,6 +215,8 @@ private slots: void stdvector() { qWarning() << "std::vector results: "; } void stdvector_const_read_access(); void stdvector_mutable_read_access(); + void stdvector_pop_back(); + #ifdef TEST_RETURN void stdvector_fill_and_return(); #endif @@ -315,6 +318,24 @@ void tst_QVector::qrawvector_mutable_read_access() } } +void tst_QVector::qvector_pop_back() +{ + const int c1 = 100000; + QVERIFY(N % c1 == 0); + + QVector<int> v; + v.resize(N); + + QBENCHMARK { + for (int i = 0; i < c1; ++i) + v.pop_back(); + if (v.size() == 0) + v.resize(N); + } +} + + + #ifdef TEST_RETURN extern QVector<double> qrawvector_fill_and_return_helper(); @@ -356,6 +377,22 @@ void tst_QVector::stdvector_mutable_read_access() } } +void tst_QVector::stdvector_pop_back() +{ + const int c1 = 100000; + QVERIFY(N % c1 == 0); + + std::vector<int> v; + v.resize(N); + + QBENCHMARK { + for (int i = 0; i < c1; ++i) + v.pop_back(); + if (v.size() == 0) + v.resize(N); + } +} + #ifdef TEST_RETURN extern std::vector<double> stdvector_fill_and_return_helper(); |