X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=main.ml;h=342bb2f1ed6f556fb8bce1b548d01fecb68f8137;hb=cad5e2e2831477cba1f6211c57b9a4cc5b58bd55;hp=c88983303c0227f2919be9402640e019f22b1df8;hpb=cf6d366b25132eea7b0f1966c11d034d748af0fa;p=SXSI%2Fxpathcomp.git diff --git a/main.ml b/main.ml index c889833..342bb2f 100644 --- a/main.ml +++ b/main.ml @@ -16,10 +16,10 @@ let disabled_gc = { Gc.get() with let hash x = 131*x/(x-1+1) let test_loop tree tag = - let t' = Tree.tagged_desc tree tag Tree.root in + let t' = Tree.tagged_descendant tree tag Tree.root in let f = Hashtbl.create 4096 in - let jump t _ = Tree.tagged_foll_ctx tree tag t Tree.root in + let jump t _ = Tree.tagged_following_below tree tag t Tree.root in let g t ctx = if t == Tree.nil then 0 else 1+ ((Hashtbl.find f (hash 101)) (jump t ctx) ctx) @@ -41,10 +41,10 @@ let test_full tree = let test_loop2 tree tag = - let t' = Tree.tagged_desc tree tag Tree.root in + let t' = Tree.tagged_descendant tree tag Tree.root in let f = Hashtbl.create 4096 in - let jump t _ = Tree.tagged_foll_ctx tree tag t Tree.root in + let jump t _ = Tree.tagged_following_below tree tag t Tree.root in let rec g t ctx = if t == Tree.nil then 0 else 1+ (match (Hashtbl.find f (hash 101)) with @@ -64,6 +64,12 @@ let main v query_string output = with 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 _ = Printf.eprintf "Timing first_child/next_sibling %!" in + let _ = time (Tree.benchmark_fsns) v in + let _ = Printf.eprintf "Timing jump to a %!" in + let _ = time (Tree.benchmark_jump v) (Tag.tag "a") 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