Scala.js Semantics - and how they support performance and JavaScript interop
summary
Scala.js defines precise runtime rules that make Scala values behave like JavaScript where needed and preserve Scala semantics elsewhere, with a three-mode safety model (full checks in dev, unchecked fast mode in prod). Integers use real 32-bit encoding (a |0 trick) so tight math is fast and boxing disappears, longs live in a userland library and stay slow, and a whole-program optimizer eliminates lambdas and allocations (foldLeft becomes a while loop), achieving near-handwritten JS speeds on Octane; Closure sometimes regresses.
AI-written summary · about
chapters (6)
- 0:00Start
- 7:48Primitive Data Types
- 15:16Define Behaviors
- 20:19Javascript Interop
- 24:12Runtime Semantics
- 28:06Primitive Types
related talks
54mThe Things Scala js Does to Make Your Code Fast
49mScala js: getting the best of JavaScript and Scala
52mJavaScript at the Speed of Light
01h 31mScala.js Workshop
30mThe future of Javascript
29mExtreme JavaScript Performance
27mJavaScript as a compilation target - Making it fast
31mJavaScript Compilation Techniques or "Wasn't JavaScript supposed to be slow?"
