.
[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 XsltProc : ENGINE =
31 struct
32   let name = "XSLTProc"
33
34     (* Todo call the binary to actually compute the version string *)
35   let description = 
36 "xsltproc is a command line tool for applying XSLT stylesheets to XML
37 documents. It is part of libxslt(3), the XSLT C library for GNOME.
38 While it was developed as part of the GNOME project, it can operate
39 independently of the GNOME desktop.
40 Using libxml 20632, libxslt 10124 and libexslt 813
41 "
42   let command = "xsltproc"
43   let reference = false
44   let time_factor = 1.0
45   let mk_queryfile b doc q out = build_xslt doc q out b
46   let mk_cmdline b qout qfile doc _ = [ "--timing" ; "-o";qout; qfile; doc ]
47   let parse_rules = [ (".*Parsing stylesheet test.xsl took \\([0-9]+\\) ms.*",
48                        [ Query_compile_time 1 ]);
49                       
50                       (".*Parsing document tiny.xml took \\([0-9]+\\) ms.*",
51                        [ Input_parsing_time 1 ]);
52                         
53                       (".*Running stylesheet and saving result took \\([0-9]+\\) ms.*",
54                        [ Query_execution_time 1 ]);
55                     ]
56 end
57 module SXSI : ENGINE =
58 struct
59   let name = "SXSI"
60   let description = ""
61   let command = "../main"
62   let reference = false
63   let time_factor = 1.0
64   let mk_queryfile b doc q out = ()
65   let mk_cmdline b qout qfile doc q = 
66     let doc' = (Filename.chop_suffix doc ".xml")^".srx" in
67       [ doc'; q ]@ (if b then [qout] else [])
68   let parse_rules = 
69     [  ( ".*Parsing document :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
70          [ Input_parsing_time 1]);
71
72        ( ".*Compiling query :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
73          [ Query_compile_time 1]);
74
75        ( ".*Execution time :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
76          [ Query_execution_time 1]);
77
78        ( ".*Serializing results :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
79          [ Serialization_time 1]);
80     ]
81
82 end
83
84
85 INCLUDE "config.ml"
86
87
88 let l = TEST.test_engine [] (make_queryset 
89                                documents
90                                queries
91                                )
92 ;;
93
94
95 List.iter (function (e,d),s -> 
96              Printf.printf "\n--------------  %s   -----------------" e;
97              Array.iter ( fun i ->
98                print_newline ();
99                print_newline ();
100                print_stats Format.std_formatter i) (List.hd s);
101              Printf.printf "\n----------------------------------------\n"
102           ) l