Initial commit
[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 = [ doc; q ]@ (if b then [qout] else [])
66   let parse_rules = 
67     [  ( ".*Parsing document :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
68          [ Input_parsing_time 1]);
69
70        ( ".*Compiling query :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
71          [ Query_compile_time 1]);
72
73        ( ".*TopDown (No BackTrack) :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
74          [ Query_execution_time 1]);
75
76        ( ".*Serializing results :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
77          [ Serialization_time 1]);
78     ]
79
80 end
81
82 module CONF : CONFIGURATION = 
83 struct
84   let path = "."
85   let result_basename = "test"
86   let num_runs = 5
87   let run_with_output = true
88   let run_without_output = true
89 end
90
91 module I = INIT_TESTER (CONF)
92 module Test = MK (SXSI) (MK (SaxonBXQuery) (I))
93
94 let l = Test.test_engine [] (make_queryset 
95                                ["/home/kim/Documents/Work/Code/xpathcomp/tests/small.xml"] 
96                                ["/descendant::*/descendant::*/descendant::*"])
97 ;;
98 List.iter (function (e,d),s -> 
99              Printf.printf "\n--------------  %s   -----------------" e;
100              Array.iter ( fun i ->
101                print_newline ();
102                print_newline ();
103                print_stats Format.std_formatter i) (List.hd s);
104              Printf.printf "\n----------------------------------------\n"
105           ) l