File: introduction.html

package info (click to toggle)
erlang-doc-html 1%3A11.b.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 23,284 kB
  • ctags: 10,724
  • sloc: erlang: 505; ansic: 323; makefile: 62; perl: 61; sh: 45
file content (73 lines) | stat: -rw-r--r-- 2,836 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
  <TITLE>Introduction</TITLE>
  <SCRIPT type="text/javascript" src="../../doc/erlresolvelinks.js">
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
      ALINK="#FF0000">
<CENTER>
<A HREF="http://www.erlang.se"><IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif"></A>
</CENTER>
<A NAME="1"><!-- Empty --></A>
<H2>1 Introduction</H2>
<A NAME="1.1"><!-- Empty --></A>
<H3>1.1 Purpose</H3>

<P>In the most perfect of all worlds this document would not be
needed. The compiler would be able to make all necessary
optimizations. Alas the world is not perfect!

<P>All considerations for efficiency are more or less
implementation dependent. Efficient code is not always good code
from the perspective of generality, ease of understanding and
maintaining. Therefor programming becomes a balance act between
generality and efficiency. So how do we manage to walk on the
lim and not fall off? Well, on a structural level there are
things that you can keep in mind while you design your code.
This guide will try to help you use data structures and
mechanisms of Erlang/OTP in the intended way, this will help you
avoid many unnecessary bottlenecks. Apart from those structal
considerations, you should never optimize before you profiled
your code and found the bottlenecks. Also remember not all code
is time critical, if it does not matter if takes a few seconds
more or less there is no point in trying to optimize
it. Profiling erlang code is easy using tools such as
<CODE>eprof</CODE>, <CODE>fprof</CODE> (from release 8 and forward) and
<CODE>cover.</CODE> Using these tools are just a matter of calling a
few functions in the respective library modules. Taking the
appropriate measures to speed the code up once you found the
bottlenecks can be a bit harder. You may have to invent new
algorithms or in other ways restructure your program. This guide
will give you some background knowledge to be able to come up
with solutions.

<P>
<TABLE CELLPADDING=4>
  <TR>
    <TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
    <TD>

<P>For the sake of readability, the example code has been kept
        as simple as possible. It does not include functionality such
        as error handling, which might be vital in a real-life system.
        Inspiration for the examples is taken from code that has
        existed in real projects.
    </TD>
  </TR>
</TABLE>
<A NAME="1.2"><!-- Empty --></A>
<H3>1.2 Pre-requisites</H3>

<P>It is assumed that the reader is familiar with the Erlang
programming language and concepts of OTP.<CENTER>
<HR>
<SMALL>
Copyright &copy; 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>