aboutsummaryrefslogtreecommitdiffstats
path: root/system/doc/efficiency_guide/introduction.xml
diff options
context:
space:
mode:
Diffstat (limited to 'system/doc/efficiency_guide/introduction.xml')
-rw-r--r--system/doc/efficiency_guide/introduction.xml69
1 files changed, 69 insertions, 0 deletions
diff --git a/system/doc/efficiency_guide/introduction.xml b/system/doc/efficiency_guide/introduction.xml
new file mode 100644
index 0000000000..ba942c75c2
--- /dev/null
+++ b/system/doc/efficiency_guide/introduction.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2001</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>Introduction</title>
+ <prepared>Bjorn Gustavsson</prepared>
+ <docno></docno>
+ <date>2007-11-21</date>
+ <rev></rev>
+ <file>introduction.xml</file>
+ </header>
+
+ <section>
+ <title>Purpose</title>
+
+ <quote><p>Premature optimization is the root of all evil. -- D.E. Knuth</p></quote>
+
+ <p>Efficient code can be well-structured and clean code, based on
+ on a sound overall architecture and sound algorithms.
+ Efficient code can be highly implementation-code that bypasses
+ documented interfaces and takes advantage of obscure quirks in
+ the current implementation.</p>
+
+ <p>Ideally, your code should only contain the first kind of efficient
+ code. If that turns out to be too slow, you should profile the application
+ to find out where the performance bottlenecks are and optimize only the
+ bottlenecks. Other code should stay as clean as possible.</p>
+
+ <p>Fortunately, compiler and run-time optimizations introduced in
+ R12B makes it easier to write code that is both clean and
+ efficient. For instance, the ugly workarounds needed in R11B and earlier
+ releases to get the most speed out of binary pattern matching are
+ no longer necessary. In fact, the ugly code is slower
+ than the clean code (because the clean code has become faster, not
+ because the uglier code has become slower).</p>
+
+ <p>This Efficiency Guide cannot really learn you how to write efficient
+ code. It can give you a few pointers about what to avoid and what to use,
+ and some understanding of how certain language features are implemented.
+ We have generally not included general tips about optimization that will
+ work in any language, such as moving common calculations out of loops.</p>
+ </section>
+
+ <section>
+ <title>Prerequisites</title>
+ <p>It is assumed that the reader is familiar with the Erlang
+ programming language and concepts of OTP.</p>
+ </section>
+</chapter>
+