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:
\begin{itemize}
\item First write \emph{readable} and \emph{maintainable} code.
\item Make sure your code is \emph{correct}.
\item Only optimise when needed.
\end{itemize}
\bigskip
......@@ -66,7 +67,7 @@
\begin{itemize}
\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).
\end{itemize}
\bigskip
\pause
......@@ -169,8 +170,8 @@
\begin{tabular}{ll}
Algorithm & Complexity\\
\hline
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 @@
\end{pframe}
\begin{pframe}
Using a \emph{set} datas tructure.
Using a \emph{set} data structure.
\bigskip
\begin{lstlisting}[language=python, caption={Find gene names in some text.}]
......@@ -416,7 +417,7 @@
\subsection{Bottlenecks}
\begin{pframe}
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.}
\bigskip
Finding \emph{bottlenecks} in your code (focus on the $10\%$).
......@@ -429,7 +430,7 @@
\end{itemize}
\bigskip
But it often is hard to find.
But often it is hard to find.
\end{pframe}
\subsection{Profilers}
......@@ -530,6 +531,23 @@
\end{figure}
\end{pframe}
\section{Conclusions}
\subsection{Think before you buy}
\begin{pframe}
Design outperforms brute force.
\begin{itemize}
\item Analyse the bottlenecks.
\item Do not hesitate to ask for help.
\end{itemize}
\bigskip
Small investments can matter a lot.
\begin{itemize}
\item Choosing correct data structures.
\item Rewriting in an other language.
\end{itemize}
\end{pframe}
\section{Questions?}
\lastpagetemplate
\begin{pframe}
......
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