From 1cc8044ffc6073749e34dcf1434f02272fe4b457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 7 Jun 2016 15:14:16 +0200 Subject: Retire two myths --- system/doc/efficiency_guide/retired_myths.xml | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 system/doc/efficiency_guide/retired_myths.xml (limited to 'system/doc/efficiency_guide/retired_myths.xml') diff --git a/system/doc/efficiency_guide/retired_myths.xml b/system/doc/efficiency_guide/retired_myths.xml new file mode 100644 index 0000000000..37f46566cd --- /dev/null +++ b/system/doc/efficiency_guide/retired_myths.xml @@ -0,0 +1,63 @@ + + + + +
+ + 2016 + 2016 + Ericsson AB, All Rights Reserved + + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Retired Myths + Bjorn Gustavsson + + 2016-06-07 + + retired_myths.xml +
+ +

We belive that the truth finally has caught with the following, + retired myths.

+ +
+ Myth: Funs are Slow +

Funs used to be very slow, slower than apply/3. + Originally, funs were implemented using nothing more than + compiler trickery, ordinary tuples, apply/3, and a great + deal of ingenuity.

+ +

But that is history. Funs was given its own data type + in R6B and was further optimized in R7B. + Now the cost for a fun call falls roughly between the cost for a call + to a local function and apply/3.

+
+ +
+ Myth: List Comprehensions are Slow + +

List comprehensions used to be implemented using funs, and in the + old days funs were indeed slow.

+ +

Nowadays, the compiler rewrites list comprehensions into an ordinary + recursive function. Using a tail-recursive function with + a reverse at the end would be still faster. Or would it? + That leads us to the myth that tail-recursive functions are faster + than body-recursive functions.

+
+
-- cgit v1.2.3