summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-08-17 20:47:32 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-08-24 10:36:37 (GMT)
commitd28522a1b0e2d1170751b2c559d13e6c96a2a54c (patch)
tree2899d781cb20b78a2201e42712736899f82b93da /tests/benchmarks
parent8063e04f3bf6e46ec972b6cafea39454a47e16de (diff)
downloadQt-d28522a1b0e2d1170751b2c559d13e6c96a2a54c.zip
Qt-d28522a1b0e2d1170751b2c559d13e6c96a2a54c.tar.gz
Qt-d28522a1b0e2d1170751b2c559d13e6c96a2a54c.tar.bz2
Update the data generation script to use a non-including .cpp
This speeds up the writing of algorithms, so I don't have to recompile megabytes of data dumps.
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/corelib/tools/qstring/data.h12
-rw-r--r--tests/benchmarks/corelib/tools/qstring/generatelist.pl21
-rw-r--r--tests/benchmarks/corelib/tools/qstring/main.cpp2
-rw-r--r--tests/benchmarks/corelib/tools/qstring/qstring.pro2
4 files changed, 23 insertions, 14 deletions
diff --git a/tests/benchmarks/corelib/tools/qstring/data.h b/tests/benchmarks/corelib/tools/qstring/data.h
new file mode 100644
index 0000000..a23dae3
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qstring/data.h
@@ -0,0 +1,12 @@
+#include <qglobal.h>
+
+struct StringCollection
+{
+ int len;
+ int offset1, offset2;
+ ushort align1, align2;
+};
+
+extern const ushort stringCollectionData[];
+extern StringCollection stringCollection[];
+extern const int stringCollectionCount;
diff --git a/tests/benchmarks/corelib/tools/qstring/generatelist.pl b/tests/benchmarks/corelib/tools/qstring/generatelist.pl
index ed4c8eb..2777329 100644
--- a/tests/benchmarks/corelib/tools/qstring/generatelist.pl
+++ b/tests/benchmarks/corelib/tools/qstring/generatelist.pl
@@ -51,10 +51,10 @@
# <data2> the second data
# \n newline
#
-# The C code to write this data would be:
+# The code to write this data would be:
# fprintf(out, "LEN = %d %s %d %d\n", len,
-# (p1 == p2) : "SAME" : "DIFF",
-# (int)p1 & 0xfff, (int)p2 & 0xfff);
+# (p1 == p2) ? "SAME" : "DIFF",
+# uint(quintptr(p1)) & 0xfff, uint(quintptr(p2)) & 0xfff);
# fwrite(p1, 2, len, out);
# fwrite(p2, 2, len, out);
# fwrite("\n", 1, 1, out);
@@ -103,7 +103,9 @@ sub printUshortArray($$$) {
return ($offset + $headpadding, $offset + $headpadding + $len + $tailpadding);
}
-print "static const ushort stringCollectionData[] __attribute__((aligned(16))) = { \n";
+print "#include \"data.h\"\n\n";
+
+print "const ushort stringCollectionData[] __attribute__((aligned(64))) = { \n";
$count = 0;
$offset = 0;
$totalsize = 0;
@@ -160,12 +162,7 @@ while (1) {
print "\n};\n";
close IN;
-print "static struct StringCollection\n";
-print "{\n";
-print " int len;\n";
-print " int offset1, offset2;\n";
-print " ushort align1, align2;\n";
-print "} stringCollection[] = {\n";
+print "struct StringCollection stringCollection[] = {\n";
for $i (0..$count-1) {
print " {",
@@ -181,8 +178,8 @@ for $i (0..$count-1) {
}
print "};\n";
-print "static const int stringCollectionCount = $count;\n";
-print "static const int stringCollectionMaxLen = $maxlen;\n";
+print "const int stringCollectionCount = $count;\n";
+print "const int stringCollectionMaxLen = $maxlen;\n";
printf "// average comparison length: %.4f\n", ($totalsize * 1.0 / $count);
printf "// cache-line crosses: %d (%.1f%%)\n",
$cachelinecrosses, ($cachelinecrosses * 100.0 / $count / 2);
diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp
index 88dc40b..a23244d 100644
--- a/tests/benchmarks/corelib/tools/qstring/main.cpp
+++ b/tests/benchmarks/corelib/tools/qstring/main.cpp
@@ -55,7 +55,7 @@
#include <private/qsimd_p.h>
-#include "data.cpp"
+#include "data.h"
class tst_QString: public QObject
{
diff --git a/tests/benchmarks/corelib/tools/qstring/qstring.pro b/tests/benchmarks/corelib/tools/qstring/qstring.pro
index 44fb46b..e8720e1 100644
--- a/tests/benchmarks/corelib/tools/qstring/qstring.pro
+++ b/tests/benchmarks/corelib/tools/qstring/qstring.pro
@@ -1,7 +1,7 @@
load(qttest_p4)
TARGET = tst_bench_qstring
QT -= gui
-SOURCES += main.cpp
+SOURCES += main.cpp data.cpp
wince*:{
DEFINES += SRCDIR=\\\"\\\"