.SUFFIXES: .ml .mli .cmx .cmi .cpp
.PHONY:compute_depend version
+
.cpp.o:
@echo [CPP] $@
$(HIDE) $(CXX) $(CXXINCLUDES) -c $(CXXFLAGS) $<
CAMLparam2(tree,id);
CAMLreturn (Val_int(XMLTREE(tree)->Tag(TREENODEVAL(id))));
}
+
+extern "C" CAMLprim value caml_xml_tree_register_tag(value tree,value str){
+ CAMLparam2(tree,str);
+ CAMLlocal1(id);
+ unsigned char* tag;
+ tag = (unsigned char*) (String_val(str));
+ id = Val_int(XMLTREE(tree)->RegisterTag(tag));
+ free(tag);
+ CAMLreturn (id);
+}
+
extern "C" CAMLprim value caml_xml_tree_nullt(value unit){
CAMLparam1(unit);
CAMLreturn (NULLT);
SXSIStorageInterface::SXSIStorageInterface()
{
tree = new XMLTree();
- tree->OpenDocument(true,64);
-
+ tree->OpenDocument(false,64);
}
SXSIStorageInterface::~SXSIStorageInterface()
std::cerr << _new_text << " calls to newText\n";
std::cerr << _new_empty_text << " calls to newEmptyText\n";
std::cerr << _length_text << " bytes (=" << _length_text/1024 << "kb ) added to TextCollection\n";
- std::cerr << _heap_base << " bytes of memory (initial)\n";
- std::cerr << _heap_parsing << " bytes of memory (during parsing)\n";
- std::cerr << _heap_done << " bytes of memory (final)\n";
return;
}
benchmark.cmx: benchmark.cmi
main.cmo: benchmark.cmi
main.cmx: benchmark.cmx
+benchmark.cmi:
( ".*Compiling query :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
[ Query_compile_time 1]);
- ( ".*TopDown (No BackTrack) :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
+ ( ".*Execution time :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
[ Query_execution_time 1]);
( ".*Serializing results :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
module I = INIT_TESTER (CONF)
module Test = MK (SXSI) (MK (SaxonBXQuery) (I))
+
+
let l = Test.test_engine [] (make_queryset
- ["/home/kim/Documents/Work/Code/xpathcomp/tests/small.xml"]
+ ["/home/kim/Documents/Work/Code/xpathcomp/tests/tiny.xml"]
["/descendant::*/descendant::*/descendant::*"])
;;
+
+
+
+
+
List.iter (function (e,d),s ->
Printf.printf "\n-------------- %s -----------------" e;
Array.iter ( fun i ->
INCLUDE "debug.ml"
open Automaton
-let a = ref None
+
let l = ref [] ;;
let time f x =
let main filename query output =
- Printf.eprintf "Parsing document : %!";
- let v = time Tree.Binary.parse_xml_uri filename in
- MM(v,__LOCATION__);
- a := Some (v);
- a := None;
- Printf.eprintf "Parsing query : ";
- let query = try
- time
- XPath.Parser.parse_string query
- with
- Ulexer.Loc.Exc_located ((x,y),e) -> Printf.eprintf "character %i-%i %s\n" x y (Printexc.to_string e);exit 1
+
+ (* Just a trick to allow the C++ code to print debugging stuff first *)
+ let v = time (fun () -> let v = Tree.Binary.parse_xml_uri filename;
+ in Printf.eprintf "Parsing document : %!";v
+ ) ()
in
- Printf.eprintf "Compiling query : ";
- let auto = time XPath.Compile.compile query in
- XPath.Ast.print Format.err_formatter query;
- Format.eprintf "\n%!";
-(* Format.eprintf "Internal rep of the tree is :\n%!";
- Tree.Binary.dump v; *)
- Printf.eprintf "TopDown (No BackTrack) : \n";
- time (fun v -> ignore (TopDown.accept auto v)) v;
- Printf.eprintf "Number of nodes in the result set : %i\n" (BST.cardinal auto.result);
- begin
- match output with
- | None -> ()
- | Some f ->
-
- Printf.eprintf "Serializing results : ";
+ MM(v,__LOCATION__);
+ Printf.eprintf "Parsing query : ";
+ let query = try
+ time
+ XPath.Parser.parse_string query
+ with
+ Ulexer.Loc.Exc_located ((x,y),e) -> Printf.eprintf "character %i-%i %s\n" x y (Printexc.to_string e);exit 1
+ in
+ Printf.eprintf "Compiling query : ";
+ let auto = time XPath.Compile.compile query in
+ XPath.Ast.print Format.err_formatter query;
+ Format.eprintf "\n%!";
+ (* Format.eprintf "Internal rep of the tree is :\n%!";
+ Tree.Binary.dump v; *)
+ Printf.eprintf "Execution time : ";
+ time (fun v -> ignore (TopDown.accept auto v)) v;
+ Printf.eprintf "Number of nodes in the result set : %i\n" (BST.cardinal auto.result);
+ begin
+ match output with
+ | None -> ()
+ | Some f ->
+
+ Printf.eprintf "Serializing results : ";
time( fun () ->
let oc = open_out f in
output_string oc "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
end
module HMap = Map.Make (struct type t = int let compare x y = x - y end)
+
module HTag =
struct
type t = int
let attribute = T.hash T.attribute
let pcdata = T.hash T.pcdata
+
let pool = ref HMap.empty
+
let add_pool s =
let hash = T.hash s in
pool := HMap.add hash s !pool
add_pool "";
add_pool T.attribute;
add_pool T.pcdata
-
let _ = clear_pool ()
+let init l =
+ clear_pool ()
let tag s =
let hash = T.hash s in
end
include STag
-let _ = Callback.register "caml_hash_tag" tag
| Node (SC (_,ns)) -> norm ns
| Node(NC t) ->
let ns = next_sibling_ n.doc t in
- let txt = next_text_ n.doc t in
+ let txt =
+ if XML.Tree.is_nil ns then
+ next_text_ n.doc t
+ else prev_text_ n.doc ns
+ in
if is_empty_ n.doc txt
then norm ns
else Node (SC (txt, ns))
| { doc=d; node=Node(SC (i,_) )} -> text_xml_id_ d i
| _ -> failwith "id"
-
(* Wrapper around critical function *)
let string t = time ("TextCollection.GetText()") (string) t
let left = first_child
end
module Binary = DEBUGTREE
-