X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=main.ml;fp=main.ml;h=26b445e786a72b3d36cdd0cee3fbcb4f4e810dd5;hb=1ff2494510cb02d136cbde3a064c0c8c94ec4216;hp=342bb2f1ed6f556fb8bce1b548d01fecb68f8137;hpb=609094fe14ca90cd5417ee22de621f76d1d0ec94;p=SXSI%2Fxpathcomp.git diff --git a/main.ml b/main.ml index 342bb2f..26b445e 100644 --- a/main.ml +++ b/main.ml @@ -54,6 +54,12 @@ let test_loop2 tree tag = Hashtbl.add f (hash 101) `Foo; g t' Tree.root +type pointers +external build_pointers : Tree.t -> pointers = "caml_build_pointers" +external iter_pointers : pointers -> int = "caml_iter_pointers" +external free_pointers : pointers -> unit = "caml_free_pointers" + + let main v query_string output = let _ = Tag.init (Tree.tag_pool v) in @@ -65,11 +71,20 @@ let main v query_string output = Ulexer.Loc.Exc_located ((x,y),e) -> Printf.eprintf "character %i-%i %s\n" x y (Printexc.to_string e);exit 1 in let _ = Printf.eprintf "Number of nodes %i\n%!" (Tree.size v) in + let _ = Tree.stats v in let _ = Printf.eprintf "Timing first_child/next_sibling %!" in - let _ = time (Tree.benchmark_fsns) v in + let _ = time (Tree.benchmark_fcns) v in + let _ = Printf.eprintf "Timing last_child/prev_sibling %!" in + let _ = time (Tree.benchmark_lcps) v in let _ = Printf.eprintf "Timing jump to a %!" in let _ = time (Tree.benchmark_jump v) (Tag.tag "a") in +(* let _ = Printf.eprintf "Timing pointer allocation %!" in + let pointers = time (build_pointers) v in + let _ = Printf.eprintf "Timing pointer iteration %!" in + let i = time (iter_pointers) pointers in + let _ = Printf.eprintf "Traversed %i pointers\n\nTiming pointer deallocation %!" i in + let _ = time (free_pointers) pointers 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