Commit 11c426a4 authored by Laros's avatar Laros
Browse files

Finalised optimisation lecture.

parent 8ffe0da0
......@@ -7,7 +7,7 @@
\title{Code optimisation}
\providecommand{\myConference}{Work discussion}
\providecommand{\myDate}{Wednesday, 24 February 2011}
\providecommand{\myDate}{Wednesday, September 17, 2014}
\author{Jeroen F. J. Laros}
\providecommand{\myGroup}{Leiden Genome Technology Center}
\providecommand{\myDepartment}{Department of Human Genetics}
......@@ -41,6 +41,7 @@
Readability comes first:
\item First write \emph{readable} and \emph{maintainable} code.
\item Make sure your code is \emph{correct}.
\item Only optimise when needed.
......@@ -66,7 +67,7 @@
\item Only basic speedup.
\item Add a lot of complexity to your program.
\item Costly (\euro\,5,000 for one new node).
\item Expensive (\euro\,5,000 for one new node).
......@@ -169,8 +170,8 @@
Algorithm & Complexity\\
Intersecting sorted regions & $\mathcal{O}(n)$\\
Searching in a sorted list & $\mathcal{O}(\mathrm{log\ }n)$\\
Intersecting sorted regions & $\mathcal{O}(n)$\\
Sorting & $\mathcal{O}(n\mathrm{\ log\ }n)$\\
Pairwise alignment & $\mathcal{O}(n^2)$\\
\textit{De novo} assembly & $\mathcal{O}(2^n)$\\
......@@ -394,7 +395,7 @@
Using a \emph{set} datas tructure.
Using a \emph{set} data structure.
\begin{lstlisting}[language=python, caption={Find gene names in some text.}]
......@@ -416,7 +417,7 @@
The $90/10$ law: \textit{$90\%$ of the execution time of a computer program
is spent executing 10\% of the code.}
is spent executing $10\%$ of the code.}
Finding \emph{bottlenecks} in your code (focus on the $10\%$).
......@@ -429,7 +430,7 @@
But it often is hard to find.
But often it is hard to find.
......@@ -530,6 +531,23 @@
\subsection{Think before you buy}
Design outperforms brute force.
\item Analyse the bottlenecks.
\item Do not hesitate to ask for help.
Small investments can matter a lot.
\item Choosing correct data structures.
\item Rewriting in an other language.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment