diff options
author | Björn Gustavsson <[email protected]> | 2019-06-28 13:11:12 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2019-06-28 13:11:12 +0200 |
commit | b1ff542330a3ad5852d9f0e2c797b879494e6ca9 (patch) | |
tree | 31f2323633c95e645b818609fa049824f9ad6c28 /lib | |
parent | 6cbab5c452dfc6ea2361f02909cfe79a47352c38 (diff) | |
parent | 3a7c035afbb3ec50c4dfab1b29516e5b54c0cbcc (diff) | |
download | otp-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.erl | 9 |
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. |