X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=main.ml;h=7cc631b0f1e9c6b0191eeeb7728145f438f11007;hb=4a66518948bf6356b5cb72ba30b4d48a8c9e833a;hp=feecc1d7d892a9866dd57a9baf7001fe6f9a580e;hpb=0b725bb9913ff83cf73c5489f3b8582b881e6681;p=SXSI%2Fxpathcomp.git diff --git a/main.ml b/main.ml index feecc1d..7cc631b 100644 --- a/main.ml +++ b/main.ml @@ -21,7 +21,23 @@ let time f x = ;; let total_time () = List.fold_left (+.) 0. !l;; +let poa = TagSet.add Tag.pcdata (TagSet.singleton Tag.attribute) +let rec fill_hashtag t = + if Tree.Binary.is_node t then + begin + let tag = Tree.Binary.tag t in + let a = + if TagSet.mem tag poa + then 0 + else + fill_hashtag (Tree.Binary.first_child t) + in + let b = fill_hashtag (Tree.Binary.next_sibling t) + in a+b+1 + end + else 0 + let test_slashslash tree k = let test = @@ -187,7 +203,12 @@ let main v query output = in XPath.Ast.print Format.err_formatter query; Format.fprintf Format.err_formatter "\n%!"; - Printf.eprintf "Compiling query : "; +(* Printf.eprintf "Dummy iteration : "; + time (fill_hashtag) v; + Printf.eprintf "Dummy iteration (tag access cached) : "; + time (fill_hashtag) v; +*) + Printf.eprintf "Compiling query : "; let auto,_ = time XPath.Compile.compile query in Printf.eprintf "Execution time %s : " (if !Options.count_only then "(counting only)" else ""); begin