(***********************************************************************)
(*
- Time-stamp: <Last modified on 2013-03-10 10:49:33 CET by Kim Nguyen>
+ Time-stamp: <Last modified on 2013-03-13 21:29:17 CET by Kim Nguyen>
*)
let doc =
fprintf err_formatter "Automata: %a\n%!" Auto.Ata.print auto;
fprintf err_formatter "Evaluating automaton:\n%!";
let module Naive = Auto.Eval.Make(Tree.Naive) in
+ let t1 = Unix.gettimeofday() in
let results = Naive.eval auto doc (Tree.Naive.root doc) in
+ let teval = (Unix.gettimeofday () -. t1) *. 1000. in
+ let t1 = Unix.gettimeofday () in
output_string stdout "<xml_result>\n";
List.iter (fun n ->
Tree.Naive.print_xml stdout doc n;
output_char stdout '\n'
) results;
output_string stdout "</xml_result>\n";
- flush stdout
+ let tprint = (Unix.gettimeofday () -. t1) *. 1000. in
+ flush stdout;
+ fprintf err_formatter "evaluation time: %fms\nserialization time: %fms\n%!" teval tprint
XPath xpath = XPathFactory.newInstance().newXPath();
String expression = args[1];
InputSource inputSource = new InputSource(args[0]);
+ long startTime = System.nanoTime();
NodeList nodes = (NodeList) xpath.evaluate(expression, inputSource, XPathConstants.NODESET);
+ long evalTime = (System.nanoTime() - startTime) / 1000000;
Transformer serializer = TransformerFactory.newInstance().newTransformer();
serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
StreamResult o = new StreamResult(System.out);
+ startTime = System.nanoTime();
System.out.println("<xml_result>");
for(int i = 0; i < nodes.getLength(); i++){
Node n = nodes.item(i);
System.out.println();
};
System.out.println("</xml_result>");
+ long printTime = (System.nanoTime() - startTime) / 1000000;
+ System.err.println("evaluation time: " + evalTime + "ms");
+ System.err.println("serialization time: " + printTime + "ms");
} catch (XPathException e) {
System.out.println (e.getCause());
} catch (Exception e) {
cat "$QUERIES" | grep -v '^#' | while read qname q
do
echo "Computing $q"
- java -cp _build/tools XPathEval "$FILE" "$q" > "$RESULTS"/"$qname".xml
+ java -cp _build/tools XPathEval "$FILE" "$q" > "$RESULTS"/"$qname".xml 2> "$RESULTS"/"$qname".log
done