What should every (Dotty) developer know about hardware

Dmitry Petrashko


  • a new compiler for a Scala-like language
  • developed at LAMP EPFL
  • is currently not ready for production use
  • some of the new technologies explored in this project will find their way into future versions of Scala

About me:

  • https://github.com/darkdimius/
  • doing PhD at EPFL
  • previously worked on ScalaBlitz
  • was first to join Martin in working on Dotty in 2014
  • together with Martin build foundations of Dotty
  • started Dotty Linker & optimizer project

How does knowing this help us?

Macro Phases

Macro Phases

Macro Phases

  • Every phase traverses a tree independently
  • Reading cold data
  • Creating new subtrees
  • That live long and are promoted to OldGen of GC

Mini Phases

Mini Phases

Mini Phases

Mini Phases

  • Phases share tree traversal
  • Trees you are accessing are hot
  • Trees die fast and do not get promoted to OldGen of GC

GC promotion to OldGen

Memory accesses(cache misses)


Other approaches to combine with?


See Iulian's talk!


  • tracing & sampling profilers for initial exploration
  • Linux perf - for measuring entire applications
  • JMH -perfasm - for microbenchmarks


  • getting performance is hard, needs a lot of exploration;
  • loosing performance is easy, seemingly small changes can kill it;
  • tracking performance is crucial.

Thank you.

Q & A

Further read: