]> git.saurik.com Git - wxWidgets.git/commitdiff
Add a trivial benchmark for wxDateTime::ParseDate().
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 23 May 2011 11:06:48 +0000 (11:06 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 23 May 2011 11:06:48 +0000 (11:06 +0000)
Add a test to check the performance of this method.

See #13242.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67775 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/benchmarks/Makefile.in
tests/benchmarks/bench.bkl
tests/benchmarks/bench.dsp
tests/benchmarks/bench_vc7.vcproj
tests/benchmarks/bench_vc8.vcproj
tests/benchmarks/bench_vc9.vcproj
tests/benchmarks/datetime.cpp [new file with mode: 0644]
tests/benchmarks/makefile.bcc
tests/benchmarks/makefile.gcc
tests/benchmarks/makefile.vc
tests/benchmarks/makefile.wat

index 8c4d1960e2cdb8cffe19dc931a13b5e2c9da7702..0c638533a94030e4a6655c124d8567cacf2258b9 100644 (file)
@@ -43,6 +43,7 @@ BENCH_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
        $(CXXFLAGS)
 BENCH_OBJECTS =  \
        bench_bench.o \
+       bench_datetime.o \
        bench_htmlpars.o \
        bench_htmltag.o \
        bench_ipcclient.o \
@@ -131,6 +132,9 @@ data:
 bench_bench.o: $(srcdir)/bench.cpp
        $(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/bench.cpp
 
+bench_datetime.o: $(srcdir)/datetime.cpp
+       $(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/datetime.cpp
+
 bench_htmlpars.o: $(srcdir)/htmlparser/htmlpars.cpp
        $(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/htmlparser/htmlpars.cpp
 
index 0b7c3291731f22a398402965be924576cb204ae7..452900a95f5ac09922b43d5425c3d333e1fb8b28 100644 (file)
@@ -11,6 +11,7 @@
                     template_append="wx_append_base">
         <sources>
             bench.cpp
+            datetime.cpp
             htmlparser/htmlpars.cpp
             htmlparser/htmltag.cpp
             ipcclient.cpp
index fa92335ffeb6c9bc2696909ecbee717e5efc75d5..f87807d07838b713c0469e44306dab9efabdd3f4 100644 (file)
@@ -239,6 +239,10 @@ SOURCE=.\bench.cpp
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\datetime.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\htmlparser\htmlpars.cpp\r
 # End Source File\r
 # Begin Source File\r
index 41b6c37f9dd61990d594919380b3823bc75e5580..0968742ce1cc61a6f4ca63ce5d7fed6634a2739a 100644 (file)
                        <File\r
                                RelativePath=".\bench.cpp">\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\datetime.cpp">\r
+                       </File>\r
                        <File\r
                                RelativePath=".\htmlparser\htmlpars.cpp">\r
                        </File>\r
index ddafa8a631e4ee5640b68b9f6fac447ea063c62d..d206538dc549d6073d4df5064d5af75c6ec6feda 100644 (file)
                                RelativePath=".\bench.cpp"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\datetime.cpp"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath=".\htmlparser\htmlpars.cpp"\r
                                >\r
index 0400f4e5b603eaed0c4364075265f3ead47cae22..55726ee9c7841e7351c323529cf1561e00824af9 100644 (file)
                                RelativePath=".\bench.cpp"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\datetime.cpp"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath=".\htmlparser\htmlpars.cpp"\r
                                >\r
diff --git a/tests/benchmarks/datetime.cpp b/tests/benchmarks/datetime.cpp
new file mode 100644 (file)
index 0000000..3be9ddc
--- /dev/null
@@ -0,0 +1,20 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        tests/benchmarks/datetime.cpp
+// Purpose:     wxDateTime benchmarks
+// Author:      Vadim Zeitlin
+// Created:     2011-05-23
+// RCS-ID:      $Id$
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/datetime.h"
+
+#include "bench.h"
+
+BENCHMARK_FUNC(ParseDate)
+{
+    wxDateTime dt;
+    return dt.ParseDate("May 23, 2011") && dt.GetMonth() == wxDateTime::May;
+}
+
index b818d6d7b191c77b69e32d08184479e16f19c051..6dab7dababb4beef5f68bb98a77974cca8f08397 100644 (file)
@@ -37,6 +37,7 @@ BENCH_CXXFLAGS = $(__RUNTIME_LIBS_7) -I$(BCCDIR)\include $(__DEBUGINFO) \
        $(CPPFLAGS) $(CXXFLAGS)\r
 BENCH_OBJECTS =  \\r
        $(OBJS)\bench_bench.obj \\r
+       $(OBJS)\bench_datetime.obj \\r
        $(OBJS)\bench_htmlpars.obj \\r
        $(OBJS)\bench_htmltag.obj \\r
        $(OBJS)\bench_ipcclient.obj \\r
@@ -212,6 +213,9 @@ data:
 $(OBJS)\bench_bench.obj: .\bench.cpp\r
        $(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\bench.cpp\r
 \r
+$(OBJS)\bench_datetime.obj: .\datetime.cpp\r
+       $(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\datetime.cpp\r
+\r
 $(OBJS)\bench_htmlpars.obj: .\htmlparser\htmlpars.cpp\r
        $(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\htmlparser\htmlpars.cpp\r
 \r
index 71e83e157cf4abe2ec8e88abb96459bceda96ead..22a562f5afd8e4cf8907917868827d285dd2edf9 100644 (file)
@@ -30,6 +30,7 @@ BENCH_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG) \
        $(CXXFLAGS)\r
 BENCH_OBJECTS =  \\r
        $(OBJS)\bench_bench.o \\r
+       $(OBJS)\bench_datetime.o \\r
        $(OBJS)\bench_htmlpars.o \\r
        $(OBJS)\bench_htmltag.o \\r
        $(OBJS)\bench_ipcclient.o \\r
@@ -198,6 +199,9 @@ data:
 $(OBJS)\bench_bench.o: ./bench.cpp\r
        $(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<\r
 \r
+$(OBJS)\bench_datetime.o: ./datetime.cpp\r
+       $(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<\r
+\r
 $(OBJS)\bench_htmlpars.o: ./htmlparser/htmlpars.cpp\r
        $(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<\r
 \r
index ab4b76b1293750ac696e2669b48cc983b13d6ff1..417dbbcb685b52109f1b0fab6d242957c1421a28 100644 (file)
@@ -31,6 +31,7 @@ BENCH_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
        $(CXXFLAGS)\r
 BENCH_OBJECTS =  \\r
        $(OBJS)\bench_bench.obj \\r
+       $(OBJS)\bench_datetime.obj \\r
        $(OBJS)\bench_htmlpars.obj \\r
        $(OBJS)\bench_htmltag.obj \\r
        $(OBJS)\bench_ipcclient.obj \\r
@@ -299,6 +300,9 @@ data:
 $(OBJS)\bench_bench.obj: .\bench.cpp\r
        $(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\bench.cpp\r
 \r
+$(OBJS)\bench_datetime.obj: .\datetime.cpp\r
+       $(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\datetime.cpp\r
+\r
 $(OBJS)\bench_htmlpars.obj: .\htmlparser\htmlpars.cpp\r
        $(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\htmlparser\htmlpars.cpp\r
 \r
index c7680809325eae21ea8deb5fdc6988b9db357e5d..61ba44e23fe791401714446ec782c4e740038105 100644 (file)
@@ -226,6 +226,7 @@ BENCH_CXXFLAGS = $(__DEBUGINFO_0) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG_5) &
        $(__EXCEPTIONSFLAG_8) $(CPPFLAGS) $(CXXFLAGS)\r
 BENCH_OBJECTS =  &\r
        $(OBJS)\bench_bench.obj &\r
+       $(OBJS)\bench_datetime.obj &\r
        $(OBJS)\bench_htmlpars.obj &\r
        $(OBJS)\bench_htmltag.obj &\r
        $(OBJS)\bench_ipcclient.obj &\r
@@ -270,6 +271,9 @@ data : .SYMBOLIC
 $(OBJS)\bench_bench.obj :  .AUTODEPEND .\bench.cpp\r
        $(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<\r
 \r
+$(OBJS)\bench_datetime.obj :  .AUTODEPEND .\datetime.cpp\r
+       $(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<\r
+\r
 $(OBJS)\bench_htmlpars.obj :  .AUTODEPEND .\htmlparser\htmlpars.cpp\r
        $(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<\r
 \r