10 TIPS TO WRITE FAST STACK-SAFE FUNCTIONAL CODE IN SCALA
summary
10 concrete tips for fast, stack-safe Scala: production-built Auto-Batch automatically batches per-leg API calls to remove redundant requests and restore performance, but revealed timeouts and JVM stack overflows at deep recursion. Solutions include writing a tailored algebraic data type and evaluator, using continuation-passing style plus a trampoline interpreter to eliminate stack growth, applying smart constructors to simplify structures early, and profiling on real production data to catch optimizations that cost more than they save.
AI-written summary · about
chapters (16)
- 0:00Intro
- 3:48The Context: Logistics
- 4:17The Problem: Going from A to Z.
- 9:42Benefits / Drawbacks
- 15:38Abstraction + Implementation Abstractions must be Abstract
- 16:53Use Smart Constructors!
- 19:29Timeouts?! Where???
- 20:24Profile on Production Data!
- 21:45Fear The Big-Bad-Stack-Overflow!
- 23:09Uh-Oh Meet the FP Nemesis: the Stack Overflow!
- 28:46Defunctionalization: Functions As Data
- 35:07Mutual Recursion
- 36:44Trampolines
- 39:47Fibonacci: Final Version
- 41:33Defer is your friend!
- 45:14Tips N°3: Write your own Dedicated Data Types
related talks
01h 00mWhat The Functional Programming
01h 44mFunctional Programming: Technical Reasons to Adapt
38mThinking Less with Scala
34mHow I learned to stop worrying and love Functional Design
02h 49mFrom Java to Scala 3, from Lambdas to Functional Programming: More Readable, More Expl...
37mIntro to FP in Scala: Exploring a Toolbox for Solving Problems - Part 6 of 6
57mTen Common mistakes made in Functional Java
45mFunctional Refactoring: How to Approach It
