summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/qvector/outofline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/qvector/outofline.cpp')
-rw-r--r--tests/benchmarks/qvector/outofline.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/benchmarks/qvector/outofline.cpp b/tests/benchmarks/qvector/outofline.cpp
new file mode 100644
index 0000000..d1d72b0
--- /dev/null
+++ b/tests/benchmarks/qvector/outofline.cpp
@@ -0,0 +1,41 @@
+
+#include <QVector>
+#include <vector>
+#include "qrawvector.h"
+
+const int N = 1000000;
+double s = 0;
+
+QVector<double> qvector_fill_and_return_helper()
+{
+ QVector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+ return v;
+}
+
+QVector<double> qrawvector_fill_and_return_helper()
+{
+ QRawVector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+ return v.mutateToVector();
+}
+
+QVector<double> mixedvector_fill_and_return_helper()
+{
+ std::vector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+ return QVector<double>::fromStdVector(v);
+}
+
+
+std::vector<double> stdvector_fill_and_return_helper()
+{
+ std::vector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+ return v;
+}
+