diff options
author | John Högberg <[email protected]> | 2018-11-02 09:38:31 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-11-02 09:38:31 +0100 |
commit | 7999ddad6121db7d1b7fe44b3c6a80a8d7ff70f3 (patch) | |
tree | ce945f151c9c789bda1e54708815be5301b843a8 /system/doc/efficiency_guide/retired_myths.xml | |
parent | f9aa2fbb81470e9d58efe2cff7e394888c14a779 (diff) | |
parent | eb9ee88f4cc640065f4902e270d834bfb596d5fc (diff) | |
download | otp-7999ddad6121db7d1b7fe44b3c6a80a8d7ff70f3.tar.gz otp-7999ddad6121db7d1b7fe44b3c6a80a8d7ff70f3.tar.bz2 otp-7999ddad6121db7d1b7fe44b3c6a80a8d7ff70f3.zip |
Merge branch 'john/erts/minusminus_trapping/OTP-15371' into maint
* john/erts/minusminus_trapping/OTP-15371:
Optimize operator '--' and yield on large inputs
Inline erts_cmp
Clarify a magical allocation size
Fix trapping in lists:reverse/2
Diffstat (limited to 'system/doc/efficiency_guide/retired_myths.xml')
-rw-r--r-- | system/doc/efficiency_guide/retired_myths.xml | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/system/doc/efficiency_guide/retired_myths.xml b/system/doc/efficiency_guide/retired_myths.xml index 9b914a3b6e..144c942c2b 100644 --- a/system/doc/efficiency_guide/retired_myths.xml +++ b/system/doc/efficiency_guide/retired_myths.xml @@ -60,4 +60,18 @@ That leads us to the myth that tail-recursive functions are faster than body-recursive functions.</p> </section> + + <section> + <title>Myth: List subtraction ("--" operator) is slow</title> + + <p>List subtraction used to have a run-time complexity proportional to the + product of the length of its operands, so it was extremely slow when both + lists were long.</p> + + <p>As of OTP 22 the run-time complexity is "n log n" and the operation will + complete quickly even when both lists are very long. In fact, it is + faster and uses less memory than the commonly used workaround to convert + both lists to ordered sets before subtracting them with + <c>ordsets:subtract/2</c>.</p> + </section> </chapter> |