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)
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
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