~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to system/doc/efficiency_guide/introduction.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2010-03-09 17:34:57 UTC
  • mfrom: (10.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100309173457-4yd6hlcb2osfhx31
Tags: 1:13.b.4-dfsg-3
Manpages in section 1 are needed even if only arch-dependent packages are
built. So, re-enabled them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="latin1" ?>
 
2
<!DOCTYPE chapter SYSTEM "chapter.dtd">
 
3
 
 
4
<chapter>
 
5
  <header>
 
6
    <copyright>
 
7
      <year>2001</year><year>2009</year>
 
8
      <holder>Ericsson AB. All Rights Reserved.</holder>
 
9
    </copyright>
 
10
    <legalnotice>
 
11
      The contents of this file are subject to the Erlang Public License,
 
12
      Version 1.1, (the "License"); you may not use this file except in
 
13
      compliance with the License. You should have received a copy of the
 
14
      Erlang Public License along with this software. If not, it can be
 
15
      retrieved online at http://www.erlang.org/.
 
16
    
 
17
      Software distributed under the License is distributed on an "AS IS"
 
18
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
19
      the License for the specific language governing rights and limitations
 
20
      under the License.
 
21
    
 
22
    </legalnotice>
 
23
 
 
24
    <title>Introduction</title>
 
25
    <prepared>Bjorn Gustavsson</prepared>
 
26
    <docno></docno>
 
27
    <date>2007-11-21</date>
 
28
    <rev></rev>
 
29
    <file>introduction.xml</file>
 
30
  </header>
 
31
 
 
32
  <section>
 
33
    <title>Purpose</title>
 
34
 
 
35
    <quote><p>Premature optimization is the root of all evil. -- D.E. Knuth</p></quote>
 
36
 
 
37
    <p>Efficient code can be well-structured and clean code, based on
 
38
    on a sound overall architecture and sound algorithms.
 
39
    Efficient code can be highly implementation-code that bypasses
 
40
    documented interfaces and takes advantage of obscure quirks in
 
41
    the current implementation.</p>
 
42
    
 
43
    <p>Ideally, your code should only contain the first kind of efficient
 
44
    code. If that turns out to be too slow, you should profile the application
 
45
    to find out where the performance bottlenecks are and optimize only the
 
46
    bottlenecks. Other code should stay as clean as possible.</p>
 
47
 
 
48
    <p>Fortunately, compiler and run-time optimizations introduced in
 
49
    R12B makes it easier to write code that is both clean and
 
50
    efficient. For instance, the ugly workarounds needed in R11B and earlier
 
51
    releases to get the most speed out of binary pattern matching are
 
52
    no longer necessary. In fact, the ugly code is slower
 
53
    than the clean code (because the clean code has become faster, not
 
54
    because the uglier code has become slower).</p>
 
55
    
 
56
    <p>This Efficiency Guide cannot really learn you how to write efficient
 
57
    code. It can give you a few pointers about what to avoid and what to use,
 
58
    and some understanding of how certain language features are implemented.
 
59
    We have generally not included general tips about optimization that will
 
60
    work in any language, such as moving common calculations out of loops.</p>
 
61
  </section>
 
62
 
 
63
  <section>
 
64
    <title>Prerequisites</title>
 
65
    <p>It is assumed that the reader is familiar with the Erlang
 
66
      programming language and concepts of OTP.</p>
 
67
  </section>
 
68
</chapter>
 
69