projects
/
tatoo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
cd25399
)
Improve performance of parallel run by replacing standard hashtable with
author
Kim Nguyễn
<kn@lri.fr>
Wed, 7 Aug 2013 10:34:51 +0000
(12:34 +0200)
committer
Kim Nguyễn
<kn@lri.fr>
Wed, 7 Aug 2013 10:34:51 +0000
(12:34 +0200)
Cache.N1 array.
src/run.ml
patch
|
blob
|
history
diff --git
a/src/run.ml
b/src/run.ml
index
bd60264
..
e356128
100644
(file)
--- a/
src/run.ml
+++ b/
src/run.ml
@@
-445,22
+445,28
@@
DEFINE AND_(t1,t2) =
(fun q -> Hashtbl.add res_mapper q [])
(Ata.get_selecting_states auto)
in
(fun q -> Hashtbl.add res_mapper q [])
(Ata.get_selecting_states auto)
in
+ let dummy = [ T.nil ] in
+ let res_mapper = Cache.N1.create dummy in
+ let () =
+ StateSet.iter
+ (fun q -> Cache.N1.add res_mapper (q :> int) [])
+ (Ata.get_selecting_states auto)
+ in
let rec loop node =
if node != T.nil then
let () = loop (T.next_sibling tree node) in
let () = loop (T.first_child tree node) in
StateSet.iter
(fun q ->
let rec loop node =
if node != T.nil then
let () = loop (T.next_sibling tree node) in
let () = loop (T.first_child tree node) in
StateSet.iter
(fun q ->
- try
- let acc = Hashtbl.find res_mapper q in
- Hashtbl.replace res_mapper q (node::acc)
- with
- Not_found -> ())
+ let res = Cache.N1.find res_mapper (q :> int) in
+ if res != dummy then
+ Cache.N1.add res_mapper (q :> int) (node::res)
+ )
cache.(T.preorder tree node).NodeStatus.node.sat
in
loop (T.root tree);
List.rev (StateSet.fold
cache.(T.preorder tree node).NodeStatus.node.sat
in
loop (T.root tree);
List.rev (StateSet.fold
- (fun q acc -> (q,
Hashtbl.find res_mapper q
)::acc)
+ (fun q acc -> (q,
Cache.N1.find res_mapper (q :> int)
)::acc)
(Ata.get_selecting_states auto) [])
let prepare_run run list =
(Ata.get_selecting_states auto) [])
let prepare_run run list =
@@
-497,7
+503,6
@@
DEFINE AND_(t1,t2) =
if full then `Full (get_full_results run)
else `Normal (get_results run)
if full then `Full (get_full_results run)
else `Normal (get_results run)
-
let full_eval auto tree nodes =
match eval true auto tree nodes with
`Full l -> l
let full_eval auto tree nodes =
match eval true auto tree nodes with
`Full l -> l