aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2018-01-17 14:09:36 +0100
committerHans Bolinder <[email protected]>2018-01-22 15:27:30 +0100
commitbd873955db32c470f082c3629627a10c84c9c208 (patch)
tree75b5f2e82214b73edebc375cae41c1894996894c
parent7a37e39d45597a25ff532751c5131938b5286331 (diff)
downloadotp-bd873955db32c470f082c3629627a10c84c9c208.tar.gz
otp-bd873955db32c470f082c3629627a10c84c9c208.tar.bz2
otp-bd873955db32c470f082c3629627a10c84c9c208.zip
dialyzer: Optimize handling of a lot of warnings
If the number of warnings is huge the '--'/2 operator is slow.
-rw-r--r--lib/dialyzer/src/dialyzer_dataflow.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/dialyzer/src/dialyzer_dataflow.erl b/lib/dialyzer/src/dialyzer_dataflow.erl
index 8367432ac5..f6433a807d 100644
--- a/lib/dialyzer/src/dialyzer_dataflow.erl
+++ b/lib/dialyzer/src/dialyzer_dataflow.erl
@@ -3116,7 +3116,10 @@ state__add_warning(#state{warnings = Warnings, warning_mode = true} = State,
state__remove_added_warnings(OldState, NewState) ->
#state{warnings = OldWarnings} = OldState,
#state{warnings = NewWarnings} = NewState,
- {NewWarnings -- OldWarnings, NewState#state{warnings = OldWarnings}}.
+ case NewWarnings =:= OldWarnings of
+ true -> {[], NewState};
+ false -> {NewWarnings -- OldWarnings, NewState#state{warnings = OldWarnings}}
+ end.
state__add_warnings(Warns, #state{warnings = Warnings} = State) ->
State#state{warnings = Warns ++ Warnings}.