diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2011-10-01 17:09:51 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-10-01 17:09:51 +0100 |
| commit | c5c18113ff88ef57912bdd690297151aa0edd708 (patch) | |
| tree | 745a7835c1fe7875cd897006d24dda9ed44c5cca | |
| parent | 189219cb3f51416517fae344eabc692abfae558b (diff) | |
| download | rabbitmq-server-git-c5c18113ff88ef57912bdd690297151aa0edd708.tar.gz | |
optimise vq:drain_confirmed for the common case
This gets called on the processing of every event/msg by the queue
process and making this change improves throughout of "MCM -a" by ~1%
when running with two Erlang schedulers and bumps vq:drain_confirmed
from #20 to #36 in an fprof profile of the queue process.
| -rw-r--r-- | src/rabbit_variable_queue.erl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index d4f51f8d4a..7131714b2a 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -533,7 +533,11 @@ publish_delivered(true, Msg = #basic_message { is_persistent = IsPersistent, unconfirmed = UC1 }))}. drain_confirmed(State = #vqstate { confirmed = C }) -> - {gb_sets:to_list(C), State #vqstate { confirmed = gb_sets:new() }}. + case gb_sets:is_empty(C) of + true -> {[], State}; %% common case + false -> {gb_sets:to_list(C), State #vqstate { + confirmed = gb_sets:new() }} + end. dropwhile(Pred, State) -> case queue_out(State) of |
