From 3c50b2d985d33572e51bd3632802506d9e99f27e Mon Sep 17 00:00:00 2001 From: hanakl Date: Wed, 15 Jan 2025 23:14:27 -0600 Subject: [PATCH] Move delayedProts out of the loop --- .../test_protocolzoo_entanglement_consumer.jl | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/test/test_protocolzoo_entanglement_consumer.jl b/test/test_protocolzoo_entanglement_consumer.jl index f6a25cfd..1f9530b4 100644 --- a/test/test_protocolzoo_entanglement_consumer.jl +++ b/test/test_protocolzoo_entanglement_consumer.jl @@ -46,31 +46,33 @@ for n in 3:30 end # test for period=nothing + +@resumable function delayedProts(sim, net, n) + @yield timeout(sim, 5) + for e in edges(net) + eprot = EntanglerProt(sim, net, e.src, e.dst; rounds=-1, randomize=true, margin=5, hardmargin=3) + @process eprot() + end + + for v in 2:n-1 + sprot = SwapperProt(sim, net, v; nodeL = <(v), nodeH = >(v), chooseL = argmin, chooseH = argmax, rounds = -1) + @process sprot() + end + + for v in vertices(net) + etracker = EntanglementTracker(sim, net, v) + @process etracker() + end +end + for n in 3:30 regsize = 10 net = RegisterNet([Register(regsize) for j in 1:n]) sim = get_time_tracker(net) - @resumable function delayedProts(sim) - @yield timeout(sim, 5) - for e in edges(net) - eprot = EntanglerProt(sim, net, e.src, e.dst; rounds=-1, randomize=true, margin=5, hardmargin=3) - @process eprot() - end - - for v in 2:n-1 - sprot = SwapperProt(sim, net, v; nodeL = <(v), nodeH = >(v), chooseL = argmin, chooseH = argmax, rounds = -1) - @process sprot() - end - - for v in vertices(net) - etracker = EntanglementTracker(sim, net, v) - @process etracker() - end - end econ = EntanglementConsumer(sim, net, 1, n; period=nothing) @process econ() - @process delayedProts(sim) + @process delayedProts(sim, net, n) run(sim, 100)