.
[SXSI/xpathcomp.git] / main.ml
diff --git a/main.ml b/main.ml
index c446ef3..8264278 100644 (file)
--- a/main.ml
+++ b/main.ml
@@ -43,14 +43,25 @@ let main v query output =
        let _ = Printf.eprintf "%!" in
        let _ = match contains with
            None -> ()
-         | Some s -> Tree.Binary.init_contains v s
+         | Some s -> 
+             let r = Tree.Binary.count v s 
+             in
+               Printf.eprintf "Global count is %i, using " r;
+               if r < 60000 then begin
+                 Printf.eprintf "TextCollection contains\nCalling global contains : ";
+                 time (Tree.Binary.init_contains v) s
+               end
+               else begin
+                 Printf.eprintf "Naive contains\nCalling global contains : ";
+                 time (Tree.Binary.init_naive_contains v) s
+               end
        in
          Printf.eprintf "Execution time %s : " (if !Options.count_only then "(counting only)" else "");
          begin
            if !Options.count_only then
              failwith "Count only not implemented in this version"
            else      
-             let _ = Gc.set ({ Gc.get() with Gc.max_overhead = 1000000; Gc.space_overhead = 100 }) in
+            (* let _ = Gc.set ({ Gc.get() with Gc.max_overhead = 1000000; Gc.space_overhead = 100 }) in *)
              let result = time (if !Options.time then run_time auto else run auto) v in          
                Printf.eprintf "Number of nodes in the result set : %i\n" (TS.length result);
                Printf.eprintf "\n%!";