Analysis of Zinc (nescala 2020)

Eugene Yokota
Eugene YokotaSoftware Engineer at Lightbend
Analysis of Zinc
Eugene Yokota (@eed3si9n)

Lightbend
everything changes
separate compilation
separate compilation
A.scala
A.class B.scala
B.class
separate compilation
A.scala
A.jar B.scala
B.class
A.scala
A.class B.scala
B.class
A.sig
"Types are a property of expressions
and thus exist [only] at compile time"
— Creative Scala, Gurnell and Welsh
A.scala
A.class B.scala
B.class
A.sig
"I turned myself into a pickle, Morty!"
— Rick and Morty
incremental
(re)compilation =
minimality
• compiles sources at most once per build

only if they transitively depend on
sources that changed since the previous
build
naïve incremental
(re)compilation
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
• step 1
naïve incremental
(re)compilation
• step 2
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
initial invalidation
naïve incremental
(re)compilation
• step 3
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
transitive invalidation
naïve incremental
(re)compilation
• step 3
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
problem: results to compiling
all/most sources in the graph
name hashing
name hashing
• created by Grzegorz Kossakowski in
2013 (sbt/sbt#1026)
name hashing
• we need to prevent invalidation from
spreading like a wildfire
name hashing
• step 1 (initial compilation)
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
• inheritance (strong)
• member ref (weak)
name hashing
• step 2
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
• collect method signatures and
other information
name hashing
• step 3 (second compilation)
• compile initial invalidation

• update signature info for A
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
name hashing
• step 4
API changes: compare the
signature information before and
after compilation
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
name hashing
• step 5
member ref: transitively invalidated
only if a "used name" changed its
signature
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
name hashing
• step 4
inheritance: always transitively
invalidated
A.scala B.scala C1.scala
C3.scala
C2.scala
C4.scala
name hashing
package example
class B {
def foo: Unit = {
val a = new A
a.something
}
}
package example
class A {
def something: Int = 0
}
name hashing
used names:
example.B -> "A
example.B -> "AnyRef
example.B -> "B
example.B -> "Int
example.B -> "Object
example.B -> "Unit
example.B -> "a
example.B -> "example
example.B -> "example;A;init;
example.B -> "java;lang;Object;init;
example.B -> "scala
example.B -> "something
name hashing
package example
class B {
def foo: Unit = {
val a = new A
a.something
}
}
package example
class A {
// was 0
def something: Int = 2
}
• body change doesn't matter
name hashing
package example
class B {
def foo: Unit = {
val a = new A
a.something
}
}
package example
class A {
def something: Int = 0
// new
def somethingElse: Int = 1
}
• unused names do not matter
name hashing
package example
class C extends A {
def something: Int = 1
}
package example
class A {
def something: Int = 0
// new
def somethingElse: Int = 1
}
• inheritance propagates
invalidation
name hashing
• implementation body changes

• changes to unused methods / vals
prevents invalidation spread based on
dependency origins
subprojects local library JARs
• we only need
signature (API)
changes from
upstream
next steps
liberation from a machine
liberation from a machine
2 items
/Users/eed3si9n/work/zinc-example/A.scala -> /Users/eed3si9n/work/zinc-
example/target/scala-2.13/classes/example/A.class
/Users/eed3si9n/work/zinc-example/B.scala -> /Users/eed3si9n/work/zinc-
example/target/scala-2.13/classes/example/B.class
library dependencies:
4 items
/Users/eed3si9n/work/zinc-example/A.scala -> /Users/eed3si9n/.coursier/
cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.1/
scala-library-2.13.1.jar
/Users/eed3si9n/work/zinc-example/A.scala -> /Users/eed3si9n/.sdkman/
candidates/java/8.0.222.hs-adpt/jre/lib/rt.jar
/Users/eed3si9n/work/zinc-example/B.scala -> /Users/eed3si9n/.coursier/
cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.1/
scala-library-2.13.1.jar
/Users/eed3si9n/work/zinc-example/B.scala -> /Users/eed3si9n/.sdkman/
candidates/java/8.0.222.hs-adpt/jre/lib/rt.jar
library class names:
2 items
/Users/eed3si9n/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-
lang/scala-library/2.13.1/scala-library-2.13.1.jar -> scala.Int
/Users/eed3si9n/.sdkman/candidates/java/8.0.222.hs-adpt/jre/lib/rt.jar ->
java.lang.Object
repeatable build = build as function
sbt/zinc#712
(modular) incremental build pipelining
sbt/zinc#744
subprojects local library JARs
parser
etc
typer, pickler etc jvm
refcheck,
erasure
parser
etc
typer, pickler etc jvm
refcheck,
erasure
parser
etc
typer, pickler etc jvm
refcheck,
erasure
early/foo.jar
early/bar.jar
Thank You and stay healthy!
2020.03 mixtape
COVID-19 real-time update in US (https://
coronavirus.1point3acres.com/en)
Coronavirus update and guidance (https://
www.flattenthecurve.com/)
1 of 35

Recommended

Analysis of Zinc (ScalaSphere 2019) by
Analysis of Zinc (ScalaSphere 2019)Analysis of Zinc (ScalaSphere 2019)
Analysis of Zinc (ScalaSphere 2019)Eugene Yokota
574 views50 slides
Scala final ppt vinay by
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinayViplav Jain
227 views66 slides
C# 6.0 by
C# 6.0C# 6.0
C# 6.0Larry Nung
370 views51 slides
Make your programs Free by
Make your programs FreeMake your programs Free
Make your programs FreePawel Szulc
3.9K views149 slides
Variables in Pharo5 by
Variables in Pharo5Variables in Pharo5
Variables in Pharo5Marcus Denker
2.4K views31 slides
Aspects of love slideshare by
Aspects of love slideshareAspects of love slideshare
Aspects of love slideshareMark Baker
394 views67 slides

More Related Content

What's hot

Scala for C# Developers by
Scala for C# DevelopersScala for C# Developers
Scala for C# DevelopersOmer van Kloeten
7.4K views29 slides
Dynamically Composing Collection Operations through Collection Promises by
Dynamically Composing Collection Operations through Collection PromisesDynamically Composing Collection Operations through Collection Promises
Dynamically Composing Collection Operations through Collection PromisesMarcus Denker
727 views15 slides
CocoaConf DC - Automate with Swift - Tony Ingraldi by
CocoaConf DC -  Automate with Swift - Tony IngraldiCocoaConf DC -  Automate with Swift - Tony Ingraldi
CocoaConf DC - Automate with Swift - Tony IngraldiTony Ingraldi
1.4K views41 slides
Why I don’t want to develop iOS apps in Objective C by
Why I don’t want to develop iOS apps in Objective CWhy I don’t want to develop iOS apps in Objective C
Why I don’t want to develop iOS apps in Objective CSeniorDevOnly
288 views13 slides
Swift, a quick overview by
Swift, a quick overviewSwift, a quick overview
Swift, a quick overviewJulian Król
1.4K views20 slides
Advanced Reflection in Pharo by
Advanced Reflection in PharoAdvanced Reflection in Pharo
Advanced Reflection in PharoMarcus Denker
4.6K views46 slides

What's hot(10)

Dynamically Composing Collection Operations through Collection Promises by Marcus Denker
Dynamically Composing Collection Operations through Collection PromisesDynamically Composing Collection Operations through Collection Promises
Dynamically Composing Collection Operations through Collection Promises
Marcus Denker727 views
CocoaConf DC - Automate with Swift - Tony Ingraldi by Tony Ingraldi
CocoaConf DC -  Automate with Swift - Tony IngraldiCocoaConf DC -  Automate with Swift - Tony Ingraldi
CocoaConf DC - Automate with Swift - Tony Ingraldi
Tony Ingraldi1.4K views
Why I don’t want to develop iOS apps in Objective C by SeniorDevOnly
Why I don’t want to develop iOS apps in Objective CWhy I don’t want to develop iOS apps in Objective C
Why I don’t want to develop iOS apps in Objective C
SeniorDevOnly288 views
Swift, a quick overview by Julian Król
Swift, a quick overviewSwift, a quick overview
Swift, a quick overview
Julian Król1.4K views
Advanced Reflection in Pharo by Marcus Denker
Advanced Reflection in PharoAdvanced Reflection in Pharo
Advanced Reflection in Pharo
Marcus Denker4.6K views
Reflection in Pharo: Beyond Smalltak by Marcus Denker
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond Smalltak
Marcus Denker1.2K views
Reflection in Pharo: Beyond Smalltak by Marcus Denker
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond Smalltak
Marcus Denker746 views
2CPP04 - Objects and Classes by Michael Heron
2CPP04 - Objects and Classes2CPP04 - Objects and Classes
2CPP04 - Objects and Classes
Michael Heron370 views
Lessons Learned: Scala and its Ecosystem by Petr Hošek
Lessons Learned: Scala and its EcosystemLessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its Ecosystem
Petr Hošek3.6K views

Similar to Analysis of Zinc (nescala 2020)

About Python by
About PythonAbout Python
About PythonShao-Chuan Wang
653 views65 slides
106da session5 c++ by
106da session5 c++106da session5 c++
106da session5 c++Mukund Trivedi
430 views76 slides
Lecture 14 (inheritance basics) by
Lecture 14 (inheritance basics)Lecture 14 (inheritance basics)
Lecture 14 (inheritance basics)Abhishek Khune
499 views25 slides
02 java basics by
02 java basics02 java basics
02 java basicsbsnl007
104 views25 slides
java02.ppt by
java02.pptjava02.ppt
java02.pptMENACE4
3 views50 slides
lecture-a-java-review.ppt by
lecture-a-java-review.pptlecture-a-java-review.ppt
lecture-a-java-review.pptBRIJESHKUMAR733739
2 views50 slides

Similar to Analysis of Zinc (nescala 2020)(20)

Lecture 14 (inheritance basics) by Abhishek Khune
Lecture 14 (inheritance basics)Lecture 14 (inheritance basics)
Lecture 14 (inheritance basics)
Abhishek Khune499 views
02 java basics by bsnl007
02 java basics02 java basics
02 java basics
bsnl007104 views
java02.ppt by MENACE4
java02.pptjava02.ppt
java02.ppt
MENACE43 views
lecture-a-java-review.ppt by NadiSarj2
lecture-a-java-review.pptlecture-a-java-review.ppt
lecture-a-java-review.ppt
NadiSarj24 views
lecture-a-java-review.ppt by SquidTurbo
lecture-a-java-review.pptlecture-a-java-review.ppt
lecture-a-java-review.ppt
SquidTurbo8 views
Introduction to Scala by Rahul Jain
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Rahul Jain4.6K views
Scala, Play 2.0 & Cloud Foundry by Pray Desai
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud Foundry
Pray Desai3.3K views
Object-Oriented Programming with PHP (part 1) by Bozhidar Boshnakov
Object-Oriented Programming with PHP (part 1)Object-Oriented Programming with PHP (part 1)
Object-Oriented Programming with PHP (part 1)
Bozhidar Boshnakov432 views
Practical PHP 5.3 by Nate Abele
Practical PHP 5.3Practical PHP 5.3
Practical PHP 5.3
Nate Abele7K views

More from Eugene Yokota

Equality in Scala (ScalaMatsuri 2020) by
Equality in Scala (ScalaMatsuri 2020)Equality in Scala (ScalaMatsuri 2020)
Equality in Scala (ScalaMatsuri 2020)Eugene Yokota
998 views61 slides
sbt: core concepts and updates (Scala Love 2020) by
sbt: core concepts and updates (Scala Love 2020)sbt: core concepts and updates (Scala Love 2020)
sbt: core concepts and updates (Scala Love 2020)Eugene Yokota
394 views50 slides
sbt core concepts (ScalaMatsuri 2019) by
sbt core concepts (ScalaMatsuri 2019)sbt core concepts (ScalaMatsuri 2019)
sbt core concepts (ScalaMatsuri 2019)Eugene Yokota
790 views56 slides
pull requests I sent to scala/scala (ny-scala 2019) by
pull requests I sent to scala/scala (ny-scala 2019)pull requests I sent to scala/scala (ny-scala 2019)
pull requests I sent to scala/scala (ny-scala 2019)Eugene Yokota
703 views42 slides
sbt 1 by
sbt 1sbt 1
sbt 1Eugene Yokota
841 views59 slides
sbt server (LSP discussion, 2018 Jan) by
sbt server (LSP discussion, 2018 Jan)sbt server (LSP discussion, 2018 Jan)
sbt server (LSP discussion, 2018 Jan)Eugene Yokota
293 views12 slides

More from Eugene Yokota(12)

Equality in Scala (ScalaMatsuri 2020) by Eugene Yokota
Equality in Scala (ScalaMatsuri 2020)Equality in Scala (ScalaMatsuri 2020)
Equality in Scala (ScalaMatsuri 2020)
Eugene Yokota998 views
sbt: core concepts and updates (Scala Love 2020) by Eugene Yokota
sbt: core concepts and updates (Scala Love 2020)sbt: core concepts and updates (Scala Love 2020)
sbt: core concepts and updates (Scala Love 2020)
Eugene Yokota394 views
sbt core concepts (ScalaMatsuri 2019) by Eugene Yokota
sbt core concepts (ScalaMatsuri 2019)sbt core concepts (ScalaMatsuri 2019)
sbt core concepts (ScalaMatsuri 2019)
Eugene Yokota790 views
pull requests I sent to scala/scala (ny-scala 2019) by Eugene Yokota
pull requests I sent to scala/scala (ny-scala 2019)pull requests I sent to scala/scala (ny-scala 2019)
pull requests I sent to scala/scala (ny-scala 2019)
Eugene Yokota703 views
sbt server (LSP discussion, 2018 Jan) by Eugene Yokota
sbt server (LSP discussion, 2018 Jan)sbt server (LSP discussion, 2018 Jan)
sbt server (LSP discussion, 2018 Jan)
Eugene Yokota293 views
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver) by Eugene Yokota
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
Eugene Yokota1.3K views
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaSphere ver) by Eugene Yokota
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaSphere ver)The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaSphere ver)
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaSphere ver)
Eugene Yokota10.1K views
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaMatsuri ver) by Eugene Yokota
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaMatsuri ver)The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaMatsuri ver)
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaMatsuri ver)
Eugene Yokota1.4K views
Road to sbt 1.0: Paved with server (2015 Amsterdam) by Eugene Yokota
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Eugene Yokota2.8K views
Road to sbt 1.0 paved with server by Eugene Yokota
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
Eugene Yokota4.9K views

Recently uploaded

Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea... by
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...Safe Software
391 views59 slides
Cycleops - Automate deployments on top of bare metal.pptx by
Cycleops - Automate deployments on top of bare metal.pptxCycleops - Automate deployments on top of bare metal.pptx
Cycleops - Automate deployments on top of bare metal.pptxThanassis Parathyras
30 views12 slides
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI... by
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Marc Müller
31 views83 slides
LAVADORA ROLO.docx by
LAVADORA ROLO.docxLAVADORA ROLO.docx
LAVADORA ROLO.docxSamuelRamirez83524
7 views1 slide
ict act 1.pptx by
ict act 1.pptxict act 1.pptx
ict act 1.pptxsanjaniarun08
12 views17 slides
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)... by
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...Deltares
9 views34 slides

Recently uploaded(20)

Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea... by Safe Software
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...
Safe Software391 views
Cycleops - Automate deployments on top of bare metal.pptx by Thanassis Parathyras
Cycleops - Automate deployments on top of bare metal.pptxCycleops - Automate deployments on top of bare metal.pptx
Cycleops - Automate deployments on top of bare metal.pptx
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI... by Marc Müller
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Marc Müller31 views
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)... by Deltares
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
Deltares9 views
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... by Deltares
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
Deltares7 views
MariaDB stored procedures and why they should be improved by Federico Razzoli
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improved
Fleet Management Software in India by Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 views
El Arte de lo Possible by Neo4j
El Arte de lo PossibleEl Arte de lo Possible
El Arte de lo Possible
Neo4j34 views
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut... by HCLSoftware
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
HCLSoftware6 views
Advanced API Mocking Techniques by Dimpy Adhikary
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking Techniques
Dimpy Adhikary18 views
A first look at MariaDB 11.x features and ideas on how to use them by Federico Razzoli
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them
Federico Razzoli44 views
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... by Deltares
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
Deltares6 views
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon by Deltares
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
Deltares11 views
DSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - Parker by Deltares
DSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - ParkerDSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - Parker
DSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - Parker
Deltares8 views
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove... by Deltares
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...
Deltares15 views
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023 by Icinga
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023Upgrading Incident Management with Icinga - Icinga Camp Milan 2023
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023
Icinga36 views
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... by Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares10 views

Analysis of Zinc (nescala 2020)