cherry pick from local- branch
[SXSI/xpathcomp.git] / benchmark / main.ml
1 open Benchmark
2 open Utils
3
4 module SaxonBXQuery : ENGINE =
5 struct
6   let name = "SaxonBXquery"
7
8     (* Todo call the binary to actually compute the version string *)
9   let description = 
10 "SaxonB XQuery engine
11 Java version 1.6.0_0
12 Saxon 9.0.0.4J from Saxonica"
13   let command = "saxonb-xquery"
14   let reference = false
15   let time_factor = 1.0
16   let mk_queryfile b doc q out = build_xquery doc q out b
17   let mk_cmdline b qout qfile _ _ = [ "-t" ; "-pipe:push";"-o:"^qout; qfile ]
18   let parse_rules = [ (".*Analysis time: \\([0-9]+\\) milliseconds.*",
19                        [ Query_compile_time 1 ]);
20                       
21                       (".*Tree built in \\([0-9]+\\) milliseconds.*",
22                        [ Input_parsing_time 1 ]);
23                         
24                       (".*Execution time: \\([0-9]+\\) milliseconds.*",
25                        [ Query_execution_time 1 ]);
26                     ]
27   let reference = false
28 end
29
30 module QizxOpen : ENGINE =
31 struct
32   let name = "QizxOpen"
33
34     (* Todo call the binary to actually compute the version string *)
35   let description = 
36 "QizX/Open v2.1
37 Java version 1.6.0_0"
38   let command = "/usr/local/qizxopen-2.1/bin/qizx"
39   let reference = false
40   let time_factor = 1.0
41   let mk_queryfile b doc q out = build_xquery doc q out b
42   let mk_cmdline b qout qfile _ _ = [ "-v" ; "-out"^ (if b then qout else "/dev/null");"-q"; qfile ]
43   let parse_rules = [   
44     (".*display time: \\([0-9]+\\) ms.*",
45      [ Query_execution_time 1 ]);
46   ]
47   let reference = false
48 end
49
50 module XsltProc : ENGINE =
51 struct
52   let name = "XSLTProc"
53
54     (* Todo call the binary to actually compute the version string *)
55   let description = 
56 "xsltproc is a command line tool for applying XSLT stylesheets to XML
57 documents. It is part of libxslt(3), the XSLT C library for GNOME.
58 While it was developed as part of the GNOME project, it can operate
59 independently of the GNOME desktop.
60 Using libxml 20632, libxslt 10124 and libexslt 813
61 "
62   let command = "xsltproc"
63   let reference = false
64   let time_factor = 1.0
65   let mk_queryfile b doc q out = build_xslt doc q out b
66   let mk_cmdline b qout qfile doc _ = [ "--timing" ; "-o";qout; qfile; doc ]
67   let parse_rules = [ (".*Parsing stylesheet test.xsl took \\([0-9]+\\) ms.*",
68                        [ Query_compile_time 1 ]);
69                       
70                       (".*Parsing document tiny.xml took \\([0-9]+\\) ms.*",
71                        [ Input_parsing_time 1 ]);
72                         
73                       (".*Running stylesheet and saving result took \\([0-9]+\\) ms.*",
74                        [ Query_execution_time 1 ]);
75                     ]
76 end
77 module SXSI : ENGINE =
78 struct
79   let name = "SXSI"
80   let description = ""
81   let command = "../main"
82   let reference = false
83   let time_factor = 1.0
84   let mk_queryfile b doc q out = ()
85   let mk_cmdline b qout qfile doc q = 
86     let doc' = (Filename.chop_suffix doc ".xml")^".srx" in
87       [ doc'; q ]@ (if b then [qout] else [])
88   let parse_rules = 
89     [  ( ".*Parsing document :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
90          [ Input_parsing_time 1]);
91
92        ( ".*Compiling query :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
93          [ Query_compile_time 1]);
94
95        ( ".*Execution time :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
96          [ Query_execution_time 1]);
97
98        ( ".*Serializing results :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
99          [ Serialization_time 1]);
100     ]
101
102 end
103
104
105 INCLUDE "config.ml"
106
107
108 let l = TEST.test_engine [] (make_queryset 
109                                documents
110                                queries
111                                )
112 ;;
113
114
115 List.iter (function (e,d),s -> 
116              Printf.printf "\n--------------  %s   -----------------" e;
117              List.iter (fun k -> 
118                           Array.iteri ( fun i f ->
119                                          if (CONF.run_with_output && i=1) || (CONF.run_without_output && i = 0)
120                                          then begin
121                                          print_newline ();
122                                          print_stats Format.std_formatter f;
123                                          end
124                                          ) k) s;
125              Printf.printf "\n----------------------------------------\n"
126           ) l