summaryrefslogtreecommitdiff
path: root/src/rabbit_backing_queue_qc.erl
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-07-26 15:56:48 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2011-07-26 15:56:48 +0100
commit4bd844b22f15ab1d73914a7210622a87b32a40df (patch)
tree9074ff6a85731367bf0da85340a82733d7c07065 /src/rabbit_backing_queue_qc.erl
parent81e28d508e8fe0414f523b5f02f3cfd00e3e7899 (diff)
downloadrabbitmq-server-4bd844b22f15ab1d73914a7210622a87b32a40df.tar.gz
Convert O(N*M) to O(M*log_2(N))bug23464
Diffstat (limited to 'src/rabbit_backing_queue_qc.erl')
-rw-r--r--src/rabbit_backing_queue_qc.erl8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/rabbit_backing_queue_qc.erl b/src/rabbit_backing_queue_qc.erl
index e20bba07..93e8efad 100644
--- a/src/rabbit_backing_queue_qc.erl
+++ b/src/rabbit_backing_queue_qc.erl
@@ -234,9 +234,7 @@ next_state(S, Res, {call, ?BQMOD, ack, [AcksArg, _BQ]}) ->
#state{acks = AcksState} = S,
BQ1 = {call, erlang, element, [2, Res]},
S#state{bqstate = BQ1,
- acks = orddict:filter(fun (AckTag, _) ->
- not lists:member(AckTag, AcksArg)
- end, AcksState)};
+ acks = lists:foldl(fun orddict:erase/2, AcksState, AcksArg)};
next_state(S, Res, {call, ?BQMOD, requeue, [AcksArg, _F, _V]}) ->
#state{len = Len, messages = Messages, acks = AcksState} = S,
@@ -246,9 +244,7 @@ next_state(S, Res, {call, ?BQMOD, requeue, [AcksArg, _F, _V]}) ->
S#state{bqstate = BQ1,
len = Len + length(RequeueMsgs),
messages = queue:join(Messages, queue:from_list(RequeueMsgs)),
- acks = orddict:filter(fun (AckTag, _) ->
- not lists:member(AckTag, AcksArg)
- end, AcksState)};
+ acks = lists:foldl(fun orddict:erase/2, AcksState, AcksArg)};
next_state(S, BQ, {call, ?BQMOD, set_ram_duration_target, _Args}) ->
S#state{bqstate = BQ};