Commit 17c5c3de authored by POTTIER Francois's avatar POTTIER Francois
Browse files

DataFlow: change the bag of pending nodes from LIFO to FIFO. This is about 15x...

DataFlow: change the bag of pending nodes from LIFO to FIFO. This is about 15x faster in the computation of Menhir's invariant.
parent 36bb565f
...@@ -52,8 +52,8 @@ module Run ...@@ -52,8 +52,8 @@ module Run
[unit] should suffice, but our minimal map API does not offer a [remove] [unit] should suffice, but our minimal map API does not offer a [remove]
function. Thus, we have to use a map of variables to Booleans.) *) function. Thus, we have to use a map of variables to Booleans.) *)
let pending : variable Stack.t = let pending : variable Queue.t =
Stack.create() Queue.create()
let dirty : bool M.t = let dirty : bool M.t =
M.create() M.create()
...@@ -64,7 +64,7 @@ module Run ...@@ -64,7 +64,7 @@ module Run
let schedule (x : variable) = let schedule (x : variable) =
if not (is_dirty x) then begin if not (is_dirty x) then begin
M.add x true dirty; M.add x true dirty;
Stack.push x pending Queue.push x pending
end end
(* [update x' p'] ensures that the property associated with the variable [x'] (* [update x' p'] ensures that the property associated with the variable [x']
...@@ -109,11 +109,11 @@ module Run ...@@ -109,11 +109,11 @@ module Run
let () = let () =
try try
while true do while true do
let x = Stack.pop pending in let x = Queue.pop pending in
M.add x false dirty; M.add x false dirty;
examine x examine x
done done
with Stack.Empty -> with Queue.Empty ->
() ()
(* Expose the solution. *) (* Expose the solution. *)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment