(Looking at) Functional Programming in Assembly

While Functional Programming usually happens quite far away from Assembly programming, in order to get functional programs performant, quite some tricks are used that have effects that reach down into the dark abyss of Assembly. In this talk I want to focus on the optimizing strategy "Tail Call Elimination", a compiler optimization of particular importance for recursive function calls. Every functional programmer will tell you that writing your code using tail recursion (it doesn't matter whether you know what that is, you'll see then!) or using Haskell's "foldl" is "generally faster than foldr (Terms and Conditions apply)". But even seasoned developers often struggle explaining why and quickly resort to pointing to benchmarks or giving some vague answers around "you need less stack". In this talk I want to introduce you to what recursion is, some of the reasons why it's computationally expensive, what tail recursion is and why it's better, and why tail call elimination makes it even more awesome. We will go through some example programs implemented in Assembly (for those who ask: I'll use x86 and maybe aarch64 examples) where we, step-by-step, transform our function from head recursive to tail recursive and then will go further by eliminating the recursive call altogether.

Weitere Infos

Format other

Weitere Sessions

27.12.23
House
Join us for a cozy, un-ceremonial opening of the House of Tea! Come and chill, learn how to help yourself with the tea and share it, and/or ask any questions about the project, helping, and how you already are part of it! :)
27.12.23
Kidspace - Workshopraum in Saal B
### Eine pädagogische Einführung in das beliebte Computerspiel mit Minecraft Education. Wolltest du schon immer einmal wissen, was es mit Minecraft auf sich hat und würdest gerne herausfinden, ob du dich in dieser digitalen Sandkiste wohlfühlst? Unser 2-stündiger Workshop bietet AnfängerInnen jeden Alters das passende Umfeld, um das beliebte Spiel in Ruhe kennenzulernen.
27.12.23
Chillout Lounge
https://soundcloud.com/jeanette-tr-sbien/0116a
27.12.23
Stage Y
https://pretalx.c3voc.de/37c3-haecksen-workshops-2023/talk/GN9LDH/
27.12.23
Sendezentrum Assembly
Eröffnung der Sendezentrum Assembly
27.12.23
Pseudoroom
Wer nicht Chefredakteur einer großen Zeitung ist, kann auf andere Art die öffentliche Debatte vorantreiben: Kommunikationsguerilla im öffentlichen Raum schafft Erregungskorridore, an denen die öffentliche Debatte aufgehängt werden kann. Wir haben den Hergang verschiedener vergangener Projekte, kleinere wie größere, rekonstruiert und geben Tipps zu Theorie und Praxis.
27.12.23
Saal E
Just one sign switched and all of physics changes: Moving objects lose kinetic energy instead of gaining it and radiating objects get hotter instead of colder. Infinite velocity and infinite temperature are no longer impossible. Stars look like rainbow-colored lines instead of white dots and turning your arrow of time around into your own past is just as easy as turning from left to right. In this talk, we will explore the physics in a spacetime with signature (+,+,+,+) as presented by Greg Egan ...