3 \usepackage{../slides} |
3 \usepackage{../slides} |
4 \usepackage{../graphicss} |
4 \usepackage{../graphicss} |
5 \usepackage{../langs} |
5 \usepackage{../langs} |
6 \usepackage{../data} |
6 \usepackage{../data} |
7 \usetikzlibrary{cd} |
7 \usetikzlibrary{cd} |
|
8 \usepackage{listings-rust} |
8 |
9 |
9 |
10 |
10 \usepackage{tcolorbox} |
11 \usepackage{tcolorbox} |
11 \newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black} |
12 \newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black} |
12 \newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1} |
13 \newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1} |
474 |
475 |
475 \end{frame} |
476 \end{frame} |
476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
477 |
478 |
478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
479 { |
480 % { |
480 \setbeamercolor{background canvas}{bg=cream} |
481 % \setbeamercolor{background canvas}{bg=cream} |
481 \begin{frame}[c] |
482 % \begin{frame}[c] |
482 |
483 |
483 \frametitle{} |
484 % \frametitle{} |
484 \begin{mybox3}{}\it |
485 % \begin{mybox3}{}\it |
485 ``I enjoyed the module - it was genuinely the stand out academic |
486 % ``I enjoyed the module - it was genuinely the stand out academic |
486 experience of my undergraduate degree, and very much influenced my |
487 % experience of my undergraduate degree, and very much influenced my |
487 career interests. In fact I am currently working at ARM, in their Open |
488 % career interests. In fact I am currently working at ARM, in their Open |
488 Source Software group, on AArch64 specific optimisations for the |
489 % Source Software group, on AArch64 specific optimisations for the |
489 Java/Kotlin compiler that forms part of the Android Runtime.''\\ |
490 % Java/Kotlin compiler that forms part of the Android Runtime.''\\ |
490 \mbox{}\hfill-- Hari Limaye in year 2021/22 |
491 % \mbox{}\hfill-- Hari Limaye in year 2021/22 |
491 \end{mybox3}\pause |
492 % \end{mybox3}\pause |
492 |
493 |
493 |
494 |
494 Student numbers in CFL\medskip\\ |
495 % Student numbers in CFL\medskip\\ |
495 \begin{tabular}{ll} |
496 % \begin{tabular}{ll} |
496 2019: & 32\\ |
497 % 2019: & 32\\ |
497 2020: & 59\\ |
498 % 2020: & 59\\ |
498 2021: & 109\\ |
499 % 2021: & 109\\ |
499 2022: & 121\\ |
500 % 2022: & 121\\ |
500 \end{tabular} |
501 % \end{tabular} |
501 |
502 |
502 \end{frame} |
503 % \end{frame} |
503 } |
504 % } |
504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
505 |
506 |
506 |
507 |
507 |
508 |
508 |
509 |
653 |
654 |
654 \end{frame} |
655 \end{frame} |
655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
656 |
657 |
657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
659 {\definecolor{rred}{HTML}{C0504D} |
|
660 \setbeamercolor{background canvas}{bg=cream} |
|
661 \begin{frame}[c] |
|
662 \frametitle{Students in CFL} |
|
663 |
|
664 \begin{center} |
|
665 \begin{tikzpicture} |
|
666 \begin{axis}[symbolic x coords={2016,2017,2018,2019,2020,2021,2022,2023}, |
|
667 width = \textwidth, |
|
668 height = 5cm, |
|
669 bar width=8mm, |
|
670 nodes near coords, |
|
671 axis lines = left, |
|
672 text=black, |
|
673 ymin=0, |
|
674 clip=false, |
|
675 hide y axis, |
|
676 axis line style={-}, |
|
677 name=mygraph |
|
678 ] |
|
679 |
|
680 \addplot[ybar,style={rred,fill=rred!75,mark=none},text=black] coordinates { |
|
681 (2023,183) |
|
682 (2022,112) |
|
683 (2021,98) |
|
684 (2020,59) |
|
685 (2019,38) |
|
686 (2018,20) |
|
687 (2017,22) |
|
688 (2016,8)}; |
|
689 \end{axis} |
|
690 \node[anchor=north, yshift=-10mm] at (mygraph.south) {\small{}Student numbers since the start of the compiler module.}; |
|
691 |
|
692 \end{tikzpicture} |
|
693 \end{center} |
|
694 |
|
695 |
|
696 \end{frame} |
|
697 } |
|
698 |
|
699 |
|
700 |
|
701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
658 { |
702 { |
659 \setbeamercolor{background canvas}{bg=cream} |
703 \setbeamercolor{background canvas}{bg=cream} |
660 \begin{frame}[c] |
704 \begin{frame}[c] |
661 \frametitle{Homework} |
705 \frametitle{Homework} |
662 |
706 |
663 Until 2 years ago: I did not give out solutions; students sent emails to me and I responded to them individually.\bigskip\\ |
707 Until 2 years ago: I did not give out solutions; students |
|
708 sent emails to me and I responded to them individually.\bigskip\\ |
664 |
709 |
665 |
710 |
666 Since last year: We will review the homework mainly during the SGTs.\bigskip\\\pause |
711 Since last year: We will review the homework mainly during the SGTs.\bigskip\\\pause |
667 |
712 |
668 I will still choose the questions from the HW for the exam, but there might be |
713 I will still choose the questions from the HW for the exam, but there might be |
683 \item parser / interpreter (10\%) |
728 \item parser / interpreter (10\%) |
684 \item JVM compiler (15\%) |
729 \item JVM compiler (15\%) |
685 \item LLVM compiler (25\%) |
730 \item LLVM compiler (25\%) |
686 \end{itemize}\bigskip\pause |
731 \end{itemize}\bigskip\pause |
687 |
732 |
688 you can use \alert{any} programming language you like (Haskell, Rust)\\\pause |
733 you can use \alert{any} programming language you like (Haskell, Rust, Swift)\\\pause |
689 you can use any code I show you and is uploaded to KEATS\ldots\textbf{BUT NOTHING ELSE!} |
734 you can use any code I show you and is uploaded to KEATS\ldots\textbf{BUT NOTHING ELSE!} |
690 |
735 |
691 \end{frame} |
736 \end{frame} |
|
737 |
|
738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
739 { |
|
740 \setbeamercolor{background canvas}{bg=cream} |
|
741 \begin{frame}[c,fragile] |
|
742 \frametitle{Ammonite \& Scala 3} |
|
743 |
|
744 I will show you all my code in Amm / Scala 3 |
|
745 |
|
746 \begin{minipage}{1.4\textwidth} |
|
747 \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] |
|
748 $ amm |
|
749 Loading... |
|
750 Welcome to the Ammonite Repl 2.5.9 (Scala 3.2.2 Java 17.0.7) |
|
751 scala> 1 + 2 |
|
752 res0: Int = 3 |
|
753 \end{lstlisting} %% $ |
|
754 \end{minipage}\medskip |
|
755 \pause |
|
756 |
|
757 Do not use Amm + Scala 2! |
|
758 |
|
759 \begin{minipage}{1.4\textwidth} |
|
760 \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] |
|
761 $ amm2 |
|
762 Loading... |
|
763 Welcome to the Ammonite Repl 2.5.9 (Scala 2.13.11 Java 17.0.7) |
|
764 scala> |
|
765 \end{lstlisting} %% $ |
|
766 \end{minipage} |
|
767 \end{frame} |
|
768 } |
|
769 |
|
770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
771 { |
|
772 \setbeamercolor{background canvas}{bg=cream} |
|
773 \begin{frame}[c] |
|
774 \frametitle{For problems} |
|
775 |
|
776 \begin{itemize} |
|
777 \item Harry Dilnot |
|
778 \item Meilai |
|
779 \end{itemize} |
|
780 |
|
781 \end{frame} |
|
782 } |
|
783 |
692 |
784 |
693 |
785 |
694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
695 \begin{frame}[c] |
787 \begin{frame}[c] |
696 \frametitle{Lectures 1 - 5} |
788 \frametitle{Lectures 1 - 5} |
989 \end{itemize} |
1081 \end{itemize} |
990 |
1082 |
991 \end{frame} |
1083 \end{frame} |
992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
993 |
1085 |
|
1086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1087 { |
|
1088 \setbeamercolor{background canvas}{bg=cream} |
|
1089 \begin{frame}[c] |
|
1090 \frametitle{Rust vs.~Scala (from PEP)} |
|
1091 |
|
1092 \mbox{} |
|
1093 |
|
1094 \begin{minipage}{1.3\textwidth} |
|
1095 \begin{mybox3}{}\it\small |
|
1096 \textbf{Re: Another question of purely academic interest about regex implementation in cw3} |
|
1097 |
|
1098 This conversation is interesting to me, and I've researched it a |
|
1099 little bit [...] I also disagree with Dr.~Urban on the cost/benefit of |
|
1100 non-GC languages [...]\smallskip |
|
1101 |
|
1102 But regardless, Scala is a lot slower than, say, C or Rust. To say |
|
1103 it's not is basically wrong (imo). Perhaps one could argue that some |
|
1104 of the guarantees Scala has makes it easier to write multi-threaded |
|
1105 programs that utilise more of the CPU... but, in my opinion, this is |
|
1106 also a bit misleading. Most CPUs have something like 4 to 12 cores |
|
1107 nowadays. It's very possible that a given Scala program runs 4-12x |
|
1108 slower than its Rust equivalent. Would you rather have your program |
|
1109 run quickly and use a single core, or have it run equally |
|
1110 quickly... and... hog your entire CPU for its duration?\ldots{} |
|
1111 |
|
1112 \mbox{}\hfill-- Oliver Iliffe, discussion from PEP |
|
1113 \end{mybox3} |
|
1114 \end{minipage} |
|
1115 |
|
1116 \end{frame} |
|
1117 } |
|
1118 |
|
1119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1120 { |
|
1121 \setbeamercolor{background canvas}{bg=cream} |
|
1122 \begin{frame}[c] |
|
1123 \frametitle{Regex Lib in Rust} |
|
1124 |
|
1125 \begin{center} |
|
1126 \includegraphics[scale=0.34]{../pics/rust-regex.png} |
|
1127 \end{center} |
|
1128 |
|
1129 \end{frame} |
|
1130 } |
|
1131 |
|
1132 |
|
1133 |
|
1134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1135 { |
|
1136 \setbeamercolor{background canvas}{bg=cream} |
|
1137 \begin{frame}[c,fragile] |
|
1138 |
|
1139 \begin{columns}[t,onlytextwidth] |
|
1140 \begin{column}{1\textwidth} |
|
1141 \small re: \bl{$(abc)^{\{n\}}$}\quad str: \bl{$\underbrace{abc\ldots{}abc}_n$}\medskip\\ |
|
1142 \begin{tikzpicture}\footnotesize |
|
1143 \begin{axis}[ |
|
1144 xlabel={$n$}, |
|
1145 x label style={at={(1.07,0.0)}}, |
|
1146 ylabel={time in secs}, |
|
1147 enlargelimits=false, |
|
1148 xmax=65000, |
|
1149 ymax=100, |
|
1150 xtick={0,15000,...,60000}, |
|
1151 ytick={0,10,...,90}, |
|
1152 scaled ticks=false, |
|
1153 axis lines=left, |
|
1154 width=7cm, |
|
1155 height=5cm] |
|
1156 \addplot[black,mark=square*,mark options={fill=red}] table [x=x, y=y, col sep=comma, row sep=crcr] |
|
1157 {x, y\\ |
|
1158 0, 0\\ |
|
1159 5000, 0.487\\ |
|
1160 10000, 1.650\\ |
|
1161 15000, 3.617\\ |
|
1162 20000, 6.462\\ |
|
1163 25000, 10.736\\ |
|
1164 30000, 17.665\\ |
|
1165 35000, 25.662\\ |
|
1166 40000, 36.422\\ |
|
1167 45000, 49.119\\ |
|
1168 50000, 62.058\\ |
|
1169 55000, 75.941\\ |
|
1170 60000, 93.022\\ |
|
1171 }; |
|
1172 \end{axis} |
|
1173 \end{tikzpicture} |
|
1174 \end{column} |
|
1175 \end{columns} |
|
1176 |
|
1177 \begin{textblock}{10}(8.4,3.8) |
|
1178 \tiny |
|
1179 \begin{lstlisting}[language=Rust] |
|
1180 extern crate regex; |
|
1181 |
|
1182 use regex::Regex; |
|
1183 use std::time::Instant; |
|
1184 |
|
1185 // bounded regular expression example |
|
1186 |
|
1187 fn main() { |
|
1188 for bound in (0..=60000).step_by(5000) { |
|
1189 |
|
1190 let re = Regex::new(&format!("(abc){{{}}}", bound)).unwrap(); |
|
1191 let text = "abc".repeat(bound); |
|
1192 |
|
1193 let start_time = Instant::now(); |
|
1194 let is_match = re.is_match(&text); |
|
1195 let elapsed_time = start_time.elapsed().as_secs_f64(); |
|
1196 |
|
1197 println!("Bound: {}, Match: {}, Time: {} seconds", bound, is_match, elapsed_time); |
|
1198 } |
|
1199 } |
|
1200 \end{lstlisting} |
|
1201 \end{textblock} |
|
1202 \end{frame} |
|
1203 } |
|
1204 |
|
1205 |
994 |
1206 |
995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
996 %\begin{frame}[c] |
1208 %\begin{frame}[c] |
997 %\frametitle{Today} |
1209 %\frametitle{Today} |
998 % |
1210 % |