diff options
| author | Ayanda Dube <ayanda.dube@erlang-solutions.com> | 2020-02-14 18:14:01 +0000 |
|---|---|---|
| committer | Ayanda Dube <ayanda.dube@erlang-solutions.com> | 2020-02-14 18:21:37 +0000 |
| commit | 826c211528bb54ea90a7b5052973ac285d3fcf52 (patch) | |
| tree | 2f568fdb46891cbccf5b1c7544eed6a55571cac4 /src | |
| parent | 37cf5173205c0cdcf3a076331c83df23c346185c (diff) | |
| download | rabbitmq-server-git-826c211528bb54ea90a7b5052973ac285d3fcf52.tar.gz | |
Speedup bootstep execution by removing unnecessary
filtering and grouping of MFA specifications. This
improves speed of execution by factor of 2N, where
N is number of attributes per step, matching the
passed `AttributeName`. Dropping constants, overall
time complexity remains O(N), but cant be neglected
for modules with multiple bootstep attributes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_boot_steps.erl | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/rabbit_boot_steps.erl b/src/rabbit_boot_steps.erl index f3ead75415..69e34ebdec 100644 --- a/src/rabbit_boot_steps.erl +++ b/src/rabbit_boot_steps.erl @@ -44,21 +44,17 @@ find_steps(Apps) -> [Step || {App, _, _} = Step <- All, lists:member(App, Apps)]. run_step(Attributes, AttributeName) -> - case [MFA || {Key, MFA} <- Attributes, - Key =:= AttributeName] of - [] -> - ok; - MFAs -> - [begin - rabbit_log:debug("Applying MFA: M = ~s, F = ~s, A = ~p", - [M, F, A]), - case apply(M,F,A) of - ok -> ok; - {error, Reason} -> exit({error, Reason}) - end - end || {M,F,A} <- MFAs], - ok - end. + [begin + rabbit_log:debug("Applying MFA: M = ~s, F = ~s, A = ~p", + [M, F, A]), + case apply(M,F,A) of + ok -> ok; + {error, Reason} -> exit({error, Reason}) + end + end + || {Key, {M,F,A}} <- Attributes, + Key =:= AttributeName], + ok. vertices({AppName, _Module, Steps}) -> [{StepName, {AppName, StepName, Atts}} || {StepName, Atts} <- Steps]. |
