Commit d3ae1563 authored by erwan's avatar erwan
Browse files

perf: remove useless copy of process states (/10 memory on some examples!)

parent 5dc05d16
Pipeline #71834 passed with stages
in 5 minutes and 25 seconds
(* Time-stamp: <modified the 20/05/2021 (at 09:09) by Erwan Jahier> *)
(* Time-stamp: <modified the 23/07/2021 (at 11:19) by Erwan Jahier> *)
open Register
......@@ -60,9 +60,10 @@ let (neigbors_of_pid : 'v t -> pid -> 's * ('s neighbor * pid) list) =
Env.get st.config pid, List.map (fun n -> n, n.Register.pid) nl
let (update_neighbor_env: 'v Env.t -> 'v Register.neighbor list -> 'v Register.neighbor list) =
let (update_neighbor_env:
'v Env.t -> 'v Register.neighbor list -> 'v Register.neighbor list) =
fun e nl ->
List.map (fun n -> { n with state = Env.get_copy e n.Register.pid }) nl
List.map (fun n -> { n with state = Env.get e n.Register.pid }) nl
let update_neighbors config neighbors = StringMap.map
(fun nl -> update_neighbor_env config nl)
......@@ -84,14 +85,7 @@ let (get_enable_processes: 'v t -> 'v enable_processes) =
assert (pl_n <> []);
let all = List.fold_left
(fun acc (p,nl) ->
(* let nl0 = nl in *)
(* let nl = update_neighbor_env e nl in (* already done? *) *)
(* if List.exists2 (fun n1 n2 -> (n1.state <> n2.state)) nl nl0 then ( *)
(* dump_process "avant" (p,nl0); *)
(* dump_process "apres" (p,nl); *)
(* assert false *)
(* ); *)
let lenv = Env.get_copy e p.pid in
let lenv = Env.get e p.pid in
let al = p.enable nl lenv in
let al =
List.map (fun a ->
......
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