aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-06-28 13:11:12 +0200
committerGitHub <[email protected]>2019-06-28 13:11:12 +0200
commitb1ff542330a3ad5852d9f0e2c797b879494e6ca9 (patch)
tree31f2323633c95e645b818609fa049824f9ad6c28 /lib
parent6cbab5c452dfc6ea2361f02909cfe79a47352c38 (diff)
parent3a7c035afbb3ec50c4dfab1b29516e5b54c0cbcc (diff)
downloadotp-b1ff542330a3ad5852d9f0e2c797b879494e6ca9.tar.gz
otp-b1ff542330a3ad5852d9f0e2c797b879494e6ca9.tar.bz2
otp-b1ff542330a3ad5852d9f0e2c797b879494e6ca9.zip
Merge pull request #2306 from bjorng/bjorn/stdlib/faster-ordsets-union/OTP-15927
Optimize ordsets:union/1
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/src/ordsets.erl9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/stdlib/src/ordsets.erl b/lib/stdlib/src/ordsets.erl
index 176047079b..95b83ded8c 100644
--- a/lib/stdlib/src/ordsets.erl
+++ b/lib/stdlib/src/ordsets.erl
@@ -150,13 +150,8 @@ union(Es1, []) -> Es1.
OrdsetList :: [ordset(T)],
Ordset :: ordset(T).
-union([S1,S2|Ss]) ->
- union1(union(S1, S2), Ss);
-union([S]) -> S;
-union([]) -> [].
-
-union1(S1, [S2|Ss]) -> union1(union(S1, S2), Ss);
-union1(S1, []) -> S1.
+union(OrdsetList) ->
+ lists:umerge(OrdsetList).
%% intersection(OrdSet1, OrdSet2) -> OrdSet.
%% Return the intersection of OrdSet1 and OrdSet2.