projects
/
SXSI
/
xpathcomp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fast closure branch
[SXSI/xpathcomp.git]
/
tree.ml
diff --git
a/tree.ml
b/tree.ml
index
a034636
..
4b7cb54
100644
(file)
--- a/
tree.ml
+++ b/
tree.ml
@@
-176,7
+176,7
@@
let text_size t = text_size t.doc
module MemUnion = Hashtbl.Make (struct
type t = Ptset.Int.t*Ptset.Int.t
module MemUnion = Hashtbl.Make (struct
type t = Ptset.Int.t*Ptset.Int.t
- let equal (x,y) (z,t) = x == z
||
y == t
+ let equal (x,y) (z,t) = x == z
&&
y == t
let equal a b = equal a b || equal b a
let hash (x,y) = (* commutative hash *)
let x = Uid.to_int (Ptset.Int.uid x)
let equal a b = equal a b || equal b a
let hash (x,y) = (* commutative hash *)
let x = Uid.to_int (Ptset.Int.uid x)
@@
-430,7
+430,7
@@
let load ?(sample=64) ?(load_text=true) str =
let in_c = Unix.in_channel_of_descr fd in
let _ = set_binary_mode_in in_c true in
let load_table () =
let in_c = Unix.in_channel_of_descr fd in
let _ = set_binary_mode_in in_c true in
let load_table () =
- (let ms = input_line in_c in if ms <> magic_string then failwith
"Invalid index file"
);
+ (let ms = input_line in_c in if ms <> magic_string then failwith
("Invalid index file " ^ ms)
);
(let vs = input_line in_c in if vs <> version_string then failwith "Invalid version file");
let table : (Tag.t,(Ptset.Int.t*Ptset.Int.t*Ptset.Int.t*Ptset.Int.t)) Hashtbl.t =
Marshal.from_channel in_c
(let vs = input_line in_c in if vs <> version_string then failwith "Invalid version file");
let table : (Tag.t,(Ptset.Int.t*Ptset.Int.t*Ptset.Int.t*Ptset.Int.t)) Hashtbl.t =
Marshal.from_channel in_c
@@
-450,7
+450,7
@@
let load ?(sample=64) ?(load_text=true) str =
ntable
in
let _ = Printf.eprintf "\nLoading tag table : " in
ntable
in
let _ = Printf.eprintf "\nLoading tag table : " in
- let ntable = time
(load_table)
() in
+ let ntable = time
~count:0 load_table
() in
ignore(Unix.lseek fd (pos_in in_c) Unix.SEEK_SET);
let tree = { doc = tree_load fd load_text sample;
ttable = ntable;}
ignore(Unix.lseek fd (pos_in in_c) Unix.SEEK_SET);
let tree = { doc = tree_load fd load_text sample;
ttable = ntable;}
@@
-788,3
+788,7
@@
let stats t =
+let test_prefix t s = Array.length (text_prefix t.doc s)
+let test_suffix t s = Array.length (text_suffix t.doc s)
+let test_contains t s = Array.length (text_contains t.doc s)
+let test_equals t s = Array.length (text_equals t.doc s)