summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/corelib')
-rw-r--r--tests/benchmarks/corelib/tools/qvector/main.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/benchmarks/corelib/tools/qvector/main.cpp b/tests/benchmarks/corelib/tools/qvector/main.cpp
index 1795f2dc6f..3c6defb572 100644
--- a/tests/benchmarks/corelib/tools/qvector/main.cpp
+++ b/tests/benchmarks/corelib/tools/qvector/main.cpp
@@ -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();