diff --git a/slides.tex b/slides.tex index 732cc81..acf6ea3 100644 --- a/slides.tex +++ b/slides.tex @@ -1,6 +1,6 @@ % vim: spell spelllang=en -\documentclass[11pt]{beamer} +\documentclass[11pt,xcolor={usenames,dvipsnames}]{beamer} \usetheme{Warsaw} \usepackage[utf8]{inputenc} \usepackage[english]{babel} @@ -11,6 +11,7 @@ \usepackage{graphicx} \usepackage{my_listings} \usepackage{math} +\usepackage{tikz} \setbeamertemplate{navigation symbols}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -29,12 +30,59 @@ Slides: \url{https://tiny.tobast.fr/m2-absint-slides} \\ Article: \url{https://tiny.tobast.fr/m2-absint-article} - \tableofcontents + %\tableofcontents \end{frame} %\begin{frame} %\tableofcontents %\end{frame} -\end{document} +\section{Just-In-Time compilation} +\begin{frame}{Just-In-Time (JIT) compilation} + \begin{itemize} + \item Dynamic languages: \alert{hard to compile} (rely on runtime) + \item Yet \alert{ubiquitous}: javascript, python, \ldots + \item Idea: compile \alert{at runtime} the \alert{most used} program + parts + \item Used in browsers (JS), PyPy (Python), most JVMs (Java), \ldots + \end{itemize} + + \vspace{1em} + + \begin{center} + \begin{tikzpicture}[xscale=0.6, fill=GreenYellow] + \fill (-8, 0) rectangle (-4, 2) + node[pos=.5] {Source code}; + \fill (-2, 0) rectangle (2, 2) + node[pos=.5] {Byte code}; + \fill (4, 0) rectangle (8, 2) + node[pos=.5, align=center] {Byte/machine\\code}; + + \draw[->, line width=2] (-4,1) -- (-2,1); + \draw[->, line width=2] (2,1) -- (4,1); + \node [rotate=60, anchor=west] at (-3.75, 1.1) {Bytecode compiler}; + \node [rotate=60, anchor=west] at (2.25, 1.1) {JIT compiler}; + + \draw[RubineRed, line width=1] (0, 2) -- (0, 4); + \draw[RubineRed, line width=1, dotted] (0, 0) -- (0, 2); + \draw[RubineRed, line width=1] (0, -0.2) -- (0, 0); + + \node [rotate=90, anchor=south, RubineRed] at (-0.1, 3) {Offline}; + \node [rotate=-90, anchor=south, RubineRed] at (0.1, 3) {Runtime}; + \end{tikzpicture} + \end{center} +\end{frame} + +\begin{frame}{How is it done?} + \begin{itemize} + \item \textit{Article claim}: mostly done using \alert{hot paths} + within loops (in a single function); most speedup is \alert{type + specialization}. + \item Wrong. But, heh. (Inlining, translation to machine code, global + optimizations, lock elimination, non-volatile-write + elimination/propagation, \ldots) + \end{itemize} +\end{frame} + +\end{document}