Efficiency Guide

Version 5.6.1

Bibliography | Glossary | Cover | Top

Table of Contents


1 Introduction
1.1 Purpose
1.2 Prerequisites

2 The Eight Myths of Erlang Performance
2.1 Myth: Funs are slow
2.2 Myth: List comprehensions are slow
2.3 Myth: Tail-recursive functions are MUCH faster than recursive functions
2.4 Myth: '++' is always bad
2.5 Myth: Strings are slow
2.6 Myth: Repairing a Dets file is very slow
2.7 Myth: BEAM is a stack-based byte-code virtual machine (and therefore slow)
2.8 Myth: Use '_' to speed up your program when a variable is not used

3 Common Caveats
3.1 The regexp module
3.2 The timer module
3.3 list_to_atom/1
3.4 length/1
3.5 setelement/3
3.6 size/1
3.7 split_binary/2

4 Constructing and matching binaries
4.1 How binaries are implemented
4.2 Constructing binaries
4.3 Matching binaries

5 List handling
5.1 Creating a list
5.2 List comprehensions
5.3 Deep and flat lists
5.4 Why you should not worry about recursive lists functions

6 Functions
6.1 Pattern matching
6.2 Function Calls
6.3 Memory usage in recursion

7 Tables and databases
7.1 Ets, Dets and Mnesia
7.2 Ets specific
7.3 Mnesia specific

8 Processes
8.1 Creation of an Erlang process
8.2 Process messages
8.3 The SMP emulator

9 Advanced
9.1 Memory
9.2 System limits

10 Profiling
10.1 Do not guess about performance - profile
10.2 Big systems
10.3 What to look for
10.4 Tools
10.5 Benchmarking