+ in
+(* let _ = Printf.eprintf "Timing //keyword :" in
+ let r = time (test_loop v) (Tag.tag "keyword") in
+ let _ = Printf.eprintf "Count is %i\n%!" r in
+ let _ = Printf.eprintf "Timing //keyword 2:" in
+ let r = time (test_loop2 v) (Tag.tag "keyword") in
+ let _ = Printf.eprintf "Count is %i\n%!" r in
+ let _ = Printf.eprintf "Timing //node() :" in
+ let _ = time (test_full) v in *)
+ XPath.Ast.print Format.err_formatter query;
+ Format.fprintf Format.err_formatter "\n%!";
+ Printf.eprintf "Compiling query : ";
+ let auto,ltags,contains = time (XPath.Compile.compile ~querystring:query_string) query in
+ let _ = Ata.dump Format.err_formatter auto in
+ let _ = Printf.eprintf "%!" in
+ let jump_to =
+ match contains with
+ None -> (max_int,`NOTHING)
+ | Some s ->
+ let r = Tree.count v s
+ in
+ Printf.eprintf "%i documents in the TextCollection\n" (Tree.text_size v);
+ Printf.eprintf "Global count is %i, using " r;
+ if r < !Options.tc_threshold then begin
+ Printf.eprintf "TextCollection contains\nCalling global contains : ";
+ time (Tree.init_contains v) s;
+ end
+ else begin
+ Printf.eprintf "Naive contains\nCalling global contains : ";
+ time (Tree.init_naive_contains v) s
+ end;(r,`CONTAINS(s))
+ in
+ let test_list = jump_to in
+ (*
+ let test_list =
+ if (!Options.backward) then begin
+ Printf.eprintf "Finding min occurences : ";
+ time
+ ( List.fold_left (fun ((min_occ,kind)as acc) (tag,_) ->
+ let numtags = Tree.subtree_tags v tag Tree.root in
+ if ((numtags < min_occ) && numtags >= 2)
+ then (numtags,`TAG(tag))
+ else acc) jump_to) ltags
+ end
+ else (max_int,`NOTHING)
+ in*)
+ let _ = if (snd test_list) != `NOTHING then
+ let occ,s1,s2 = match test_list with
+ | (x,`TAG (tag)) -> (x, "tag", (Tag.to_string tag))
+ | (x,`CONTAINS(s)) -> (x, "contains()", s)
+ | _ -> assert false
+ in
+ Printf.eprintf "Will jump to %s %s occuring %i time\n%!" s1 s2 occ
+ in
+ Printf.eprintf "Execution time %s : "
+ (if !Options.count_only then "(counting only)" else if !Options.backward then "(bottomup)" else "");