SlideShare a Scribd company logo

Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by Amitpal Singh

on June 29th at ScalaMatsuri 2019. http://2019.scalamatsuri.org/index_en

1 of 37
Download to read offline
Run Scala Faster with GraalVM on any
Platform
Amitpal Singh
Director, Oracle Labs Research & Advanced
Development
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended
for information purposes only, and may not be incorporated into any contract. It
is not a commitment to deliver any material, code, or functionality, and should
not be relied upon in making purchasing decisions. The development, release,
timing, and pricing of any features or functionality described for Oracle’s
products may change and remains at the sole discretion of Oracle Corporation.
- 2
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
What is GraalVM
● Next Generation VM that runs multiple languages fast with a single
runtime
3
JVM languages Light weight Languages LLVM language
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
GraalVM architecture
● Graal and Truffle for a High Performance Multilingual Executable
VM Environment
4
Graal Compiler
JVM CI (JVM Compiler Interface)
Java Hotspot VM
Java's AST Interpreter Framework
Interface for Writing JIT Compiler in Java
Truffle Framework
JIT compiler written in Java
JavaScript
Interpreter
Ruby
Interpreter
Python
Interpreter
LLVM
Interpreter
R
Interpreter
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 5
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
GraalVM: The Graal Compiler
• Written in Java
– Modular, maintainable, and
extensible
• Comes in two flavors
– Graal CE
– Graal EE
• Advanced optimizations
– Partial Escape Analysis (Stadler et al. CGO
‘14)
– Path Duplication (Leopoldseder et al. CGO ‘18)
– Priority Inlining (Prokopec et al. CGO ‘19)
6
long count = 0, sum = 0;
for (int i = 0; i < persons.length; i++) {
Person person = persons[i];
int age = person.age;
if (person.employment == Employment.EMPLOYED &&
person.salary > 100_000 &&
age >= 40) {
sum += age;
count += 1;
}
}
return (double) sum / count;
Arrays.stream(persons)
.filter(p -> p.getEmployment() == Employment.EMPLOYED)
.filter(p -> p.getSalary() > 100_000)
.mapToInt(Person::getAge)
.filter(age -> age >= 40).average()
.getAsDouble();

Recommended

Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! David Delabassee
 
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...Marco Antonio Maciel
 
Real World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains WebinarReal World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains WebinarTrisha Gee
 
Wicked Easy Ceph Block Storage & OpenStack Deployment with Crowbar
Wicked Easy Ceph Block Storage & OpenStack Deployment with CrowbarWicked Easy Ceph Block Storage & OpenStack Deployment with Crowbar
Wicked Easy Ceph Block Storage & OpenStack Deployment with CrowbarKamesh Pemmaraju
 
Netflix Global Applications - NoSQL Search Roadshow
Netflix Global Applications - NoSQL Search RoadshowNetflix Global Applications - NoSQL Search Roadshow
Netflix Global Applications - NoSQL Search RoadshowAdrian Cockcroft
 
Gluecon 2013 - Netflix Cloud Native Tutorial Details (part 2)
Gluecon 2013 - Netflix Cloud Native Tutorial Details (part 2)Gluecon 2013 - Netflix Cloud Native Tutorial Details (part 2)
Gluecon 2013 - Netflix Cloud Native Tutorial Details (part 2)Adrian Cockcroft
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuningJerry Kurian
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgpmichaelisvy
 

More Related Content

What's hot

What's New in the JVM in Java 8?
What's New in the JVM in Java 8?What's New in the JVM in Java 8?
What's New in the JVM in Java 8?Azul Systems Inc.
 
Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8AppDynamics
 
Java: Create The Future Keynote
Java: Create The Future KeynoteJava: Create The Future Keynote
Java: Create The Future KeynoteSimon Ritter
 
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)jaxLondonConference
 
Using GPUs to Handle Big Data with Java
Using GPUs to Handle Big Data with JavaUsing GPUs to Handle Big Data with Java
Using GPUs to Handle Big Data with JavaTim Ellison
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and youKai Koenig
 
Java EE, What's Next? by Anil Gaur
Java EE, What's Next? by Anil GaurJava EE, What's Next? by Anil Gaur
Java EE, What's Next? by Anil GaurTakashi Ito
 
FPGAs in the cloud? (October 2017)
FPGAs in the cloud? (October 2017)FPGAs in the cloud? (October 2017)
FPGAs in the cloud? (October 2017)Julien SIMON
 
Gluecon 2013 - NetflixOSS Cloud Native Tutorial Introduction
Gluecon 2013 - NetflixOSS Cloud Native Tutorial IntroductionGluecon 2013 - NetflixOSS Cloud Native Tutorial Introduction
Gluecon 2013 - NetflixOSS Cloud Native Tutorial IntroductionAdrian Cockcroft
 
Netflix Cloud Platform Building Blocks
Netflix Cloud Platform Building BlocksNetflix Cloud Platform Building Blocks
Netflix Cloud Platform Building BlocksSudhir Tonse
 
Netflix Velocity Conference 2011
Netflix Velocity Conference 2011Netflix Velocity Conference 2011
Netflix Velocity Conference 2011Adrian Cockcroft
 
Boston 2009 q1_kappler_chris
Boston 2009 q1_kappler_chrisBoston 2009 q1_kappler_chris
Boston 2009 q1_kappler_chrisObsidian Software
 
Fllow con 2014
Fllow con 2014 Fllow con 2014
Fllow con 2014 gbgruver
 
Oracle Keynote from JMagghreb 2014
Oracle Keynote from JMagghreb 2014Oracle Keynote from JMagghreb 2014
Oracle Keynote from JMagghreb 2014Simon Ritter
 
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systexJames Chen
 
Efficient Memory and Thread Management in Highly Parallel Java Applications
Efficient Memory and Thread Management in Highly Parallel Java ApplicationsEfficient Memory and Thread Management in Highly Parallel Java Applications
Efficient Memory and Thread Management in Highly Parallel Java Applicationspkoza
 
Compass - JBUG presentation
Compass - JBUG presentationCompass - JBUG presentation
Compass - JBUG presentationkimchy
 
The (near) future of personal computers
The (near) future of personal computersThe (near) future of personal computers
The (near) future of personal computersKevin Goldsmith
 
Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.J On The Beach
 
Dynamic Resource Allocation Spark on YARN
Dynamic Resource Allocation Spark on YARNDynamic Resource Allocation Spark on YARN
Dynamic Resource Allocation Spark on YARNTsuyoshi OZAWA
 

What's hot (20)

What's New in the JVM in Java 8?
What's New in the JVM in Java 8?What's New in the JVM in Java 8?
What's New in the JVM in Java 8?
 
Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8
 
Java: Create The Future Keynote
Java: Create The Future KeynoteJava: Create The Future Keynote
Java: Create The Future Keynote
 
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
 
Using GPUs to Handle Big Data with Java
Using GPUs to Handle Big Data with JavaUsing GPUs to Handle Big Data with Java
Using GPUs to Handle Big Data with Java
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and you
 
Java EE, What's Next? by Anil Gaur
Java EE, What's Next? by Anil GaurJava EE, What's Next? by Anil Gaur
Java EE, What's Next? by Anil Gaur
 
FPGAs in the cloud? (October 2017)
FPGAs in the cloud? (October 2017)FPGAs in the cloud? (October 2017)
FPGAs in the cloud? (October 2017)
 
Gluecon 2013 - NetflixOSS Cloud Native Tutorial Introduction
Gluecon 2013 - NetflixOSS Cloud Native Tutorial IntroductionGluecon 2013 - NetflixOSS Cloud Native Tutorial Introduction
Gluecon 2013 - NetflixOSS Cloud Native Tutorial Introduction
 
Netflix Cloud Platform Building Blocks
Netflix Cloud Platform Building BlocksNetflix Cloud Platform Building Blocks
Netflix Cloud Platform Building Blocks
 
Netflix Velocity Conference 2011
Netflix Velocity Conference 2011Netflix Velocity Conference 2011
Netflix Velocity Conference 2011
 
Boston 2009 q1_kappler_chris
Boston 2009 q1_kappler_chrisBoston 2009 q1_kappler_chris
Boston 2009 q1_kappler_chris
 
Fllow con 2014
Fllow con 2014 Fllow con 2014
Fllow con 2014
 
Oracle Keynote from JMagghreb 2014
Oracle Keynote from JMagghreb 2014Oracle Keynote from JMagghreb 2014
Oracle Keynote from JMagghreb 2014
 
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
 
Efficient Memory and Thread Management in Highly Parallel Java Applications
Efficient Memory and Thread Management in Highly Parallel Java ApplicationsEfficient Memory and Thread Management in Highly Parallel Java Applications
Efficient Memory and Thread Management in Highly Parallel Java Applications
 
Compass - JBUG presentation
Compass - JBUG presentationCompass - JBUG presentation
Compass - JBUG presentation
 
The (near) future of personal computers
The (near) future of personal computersThe (near) future of personal computers
The (near) future of personal computers
 
Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.
 
Dynamic Resource Allocation Spark on YARN
Dynamic Resource Allocation Spark on YARNDynamic Resource Allocation Spark on YARN
Dynamic Resource Allocation Spark on YARN
 

Similar to Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by Amitpal Singh

20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVMTaewan Kim
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsDavid Delabassee
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsDavid Delabassee
 
New opportunities for Developers With GraalVM
New opportunities for Developers With GraalVMNew opportunities for Developers With GraalVM
New opportunities for Developers With GraalVMAlina Yurenko
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Shaun Smith
 
GraalVM Overview Compact version
GraalVM Overview Compact versionGraalVM Overview Compact version
GraalVM Overview Compact versionscalaconfjp
 
TechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTrivadis
 
“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the CoreC4Media
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best PracticesDavid Delabassee
 
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVMCNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVMLibbySchulze
 
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMHOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMOwais Zahid
 
GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18Jorge Hidalgo
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22Jorge Hidalgo
 
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Curity
 
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...Lucas Jellema
 
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.J On The Beach
 
Graal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them AllGraal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them AllThomas Wuerthinger
 
Scala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala TaiwanScala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala TaiwanJimin Hsieh
 

Similar to Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by Amitpal Singh (20)

20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
 
New opportunities for Developers With GraalVM
New opportunities for Developers With GraalVMNew opportunities for Developers With GraalVM
New opportunities for Developers With GraalVM
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
 
GraalVM Overview Compact version
GraalVM Overview Compact versionGraalVM Overview Compact version
GraalVM Overview Compact version
 
TechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance Interoperability
 
“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
 
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVMCNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
 
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMHOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
 
GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22
 
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2
 
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
 
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
 
Graal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them AllGraal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them All
 
Scala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala TaiwanScala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala Taiwan
 
GraalVM
GraalVMGraalVM
GraalVM
 

More from scalaconfjp

脆弱性対策のためのClean Architecture ~脆弱性に対するレジリエンスを確保せよ~
脆弱性対策のためのClean Architecture ~脆弱性に対するレジリエンスを確保せよ~脆弱性対策のためのClean Architecture ~脆弱性に対するレジリエンスを確保せよ~
脆弱性対策のためのClean Architecture ~脆弱性に対するレジリエンスを確保せよ~scalaconfjp
 
Alp x BizReach SaaS事業を営む2社がお互い気になることをゆるゆる聞いてみる会
Alp x BizReach SaaS事業を営む2社がお互い気になることをゆるゆる聞いてみる会Alp x BizReach SaaS事業を営む2社がお互い気になることをゆるゆる聞いてみる会
Alp x BizReach SaaS事業を営む2社がお互い気になることをゆるゆる聞いてみる会scalaconfjp
 
Monitoring Reactive Architecture Like Never Before / 今までになかったリアクティブアーキテクチャの監視...
Monitoring Reactive Architecture Like Never Before / 今までになかったリアクティブアーキテクチャの監視...Monitoring Reactive Architecture Like Never Before / 今までになかったリアクティブアーキテクチャの監視...
Monitoring Reactive Architecture Like Never Before / 今までになかったリアクティブアーキテクチャの監視...scalaconfjp
 
Scala 3, what does it means for me? / Scala 3って、私にはどんな影響があるの? by Joan Goyeau
Scala 3, what does it means for me? / Scala 3って、私にはどんな影響があるの? by Joan GoyeauScala 3, what does it means for me? / Scala 3って、私にはどんな影響があるの? by Joan Goyeau
Scala 3, what does it means for me? / Scala 3って、私にはどんな影響があるの? by Joan Goyeauscalaconfjp
 
Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...
Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...
Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...scalaconfjp
 
Scala ♥ Graal by Flavio Brasil
Scala ♥ Graal by Flavio BrasilScala ♥ Graal by Flavio Brasil
Scala ♥ Graal by Flavio Brasilscalaconfjp
 
Introduction to GraphQL in Scala
Introduction to GraphQL in ScalaIntroduction to GraphQL in Scala
Introduction to GraphQL in Scalascalaconfjp
 
Safety Beyond Types
Safety Beyond TypesSafety Beyond Types
Safety Beyond Typesscalaconfjp
 
Reactive Kafka with Akka Streams
Reactive Kafka with Akka StreamsReactive Kafka with Akka Streams
Reactive Kafka with Akka Streamsscalaconfjp
 
Reactive microservices with play and akka
Reactive microservices with play and akkaReactive microservices with play and akka
Reactive microservices with play and akkascalaconfjp
 
Scalaに対して意識の低いエンジニアがScalaで何したかの話, by 芸者東京エンターテインメント
Scalaに対して意識の低いエンジニアがScalaで何したかの話, by 芸者東京エンターテインメントScalaに対して意識の低いエンジニアがScalaで何したかの話, by 芸者東京エンターテインメント
Scalaに対して意識の低いエンジニアがScalaで何したかの話, by 芸者東京エンターテインメントscalaconfjp
 
DWANGO by ドワンゴ
DWANGO by ドワンゴDWANGO by ドワンゴ
DWANGO by ドワンゴscalaconfjp
 
OCTOPARTS by M3, Inc.
OCTOPARTS by M3, Inc.OCTOPARTS by M3, Inc.
OCTOPARTS by M3, Inc.scalaconfjp
 
Try using Aeromock by Marverick, Inc.
Try using Aeromock by Marverick, Inc.Try using Aeromock by Marverick, Inc.
Try using Aeromock by Marverick, Inc.scalaconfjp
 
統計をとって高速化する
Scala開発 by CyberZ,Inc.
統計をとって高速化する
Scala開発 by CyberZ,Inc.統計をとって高速化する
Scala開発 by CyberZ,Inc.
統計をとって高速化する
Scala開発 by CyberZ,Inc.scalaconfjp
 
Short Introduction of Implicit Conversion by TIS, Inc.
Short Introduction of Implicit Conversion by TIS, Inc.Short Introduction of Implicit Conversion by TIS, Inc.
Short Introduction of Implicit Conversion by TIS, Inc.scalaconfjp
 
ビズリーチ x ScalaMatsuri by BIZREACH, Inc.
ビズリーチ x ScalaMatsuri  by BIZREACH, Inc.ビズリーチ x ScalaMatsuri  by BIZREACH, Inc.
ビズリーチ x ScalaMatsuri by BIZREACH, Inc.scalaconfjp
 
sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策scalaconfjp
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論scalaconfjp
 
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一scalaconfjp
 

More from scalaconfjp (20)

脆弱性対策のためのClean Architecture ~脆弱性に対するレジリエンスを確保せよ~
脆弱性対策のためのClean Architecture ~脆弱性に対するレジリエンスを確保せよ~脆弱性対策のためのClean Architecture ~脆弱性に対するレジリエンスを確保せよ~
脆弱性対策のためのClean Architecture ~脆弱性に対するレジリエンスを確保せよ~
 
Alp x BizReach SaaS事業を営む2社がお互い気になることをゆるゆる聞いてみる会
Alp x BizReach SaaS事業を営む2社がお互い気になることをゆるゆる聞いてみる会Alp x BizReach SaaS事業を営む2社がお互い気になることをゆるゆる聞いてみる会
Alp x BizReach SaaS事業を営む2社がお互い気になることをゆるゆる聞いてみる会
 
Monitoring Reactive Architecture Like Never Before / 今までになかったリアクティブアーキテクチャの監視...
Monitoring Reactive Architecture Like Never Before / 今までになかったリアクティブアーキテクチャの監視...Monitoring Reactive Architecture Like Never Before / 今までになかったリアクティブアーキテクチャの監視...
Monitoring Reactive Architecture Like Never Before / 今までになかったリアクティブアーキテクチャの監視...
 
Scala 3, what does it means for me? / Scala 3って、私にはどんな影響があるの? by Joan Goyeau
Scala 3, what does it means for me? / Scala 3って、私にはどんな影響があるの? by Joan GoyeauScala 3, what does it means for me? / Scala 3って、私にはどんな影響があるの? by Joan Goyeau
Scala 3, what does it means for me? / Scala 3って、私にはどんな影響があるの? by Joan Goyeau
 
Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...
Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...
Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...
 
Scala ♥ Graal by Flavio Brasil
Scala ♥ Graal by Flavio BrasilScala ♥ Graal by Flavio Brasil
Scala ♥ Graal by Flavio Brasil
 
Introduction to GraphQL in Scala
Introduction to GraphQL in ScalaIntroduction to GraphQL in Scala
Introduction to GraphQL in Scala
 
Safety Beyond Types
Safety Beyond TypesSafety Beyond Types
Safety Beyond Types
 
Reactive Kafka with Akka Streams
Reactive Kafka with Akka StreamsReactive Kafka with Akka Streams
Reactive Kafka with Akka Streams
 
Reactive microservices with play and akka
Reactive microservices with play and akkaReactive microservices with play and akka
Reactive microservices with play and akka
 
Scalaに対して意識の低いエンジニアがScalaで何したかの話, by 芸者東京エンターテインメント
Scalaに対して意識の低いエンジニアがScalaで何したかの話, by 芸者東京エンターテインメントScalaに対して意識の低いエンジニアがScalaで何したかの話, by 芸者東京エンターテインメント
Scalaに対して意識の低いエンジニアがScalaで何したかの話, by 芸者東京エンターテインメント
 
DWANGO by ドワンゴ
DWANGO by ドワンゴDWANGO by ドワンゴ
DWANGO by ドワンゴ
 
OCTOPARTS by M3, Inc.
OCTOPARTS by M3, Inc.OCTOPARTS by M3, Inc.
OCTOPARTS by M3, Inc.
 
Try using Aeromock by Marverick, Inc.
Try using Aeromock by Marverick, Inc.Try using Aeromock by Marverick, Inc.
Try using Aeromock by Marverick, Inc.
 
統計をとって高速化する
Scala開発 by CyberZ,Inc.
統計をとって高速化する
Scala開発 by CyberZ,Inc.統計をとって高速化する
Scala開発 by CyberZ,Inc.
統計をとって高速化する
Scala開発 by CyberZ,Inc.
 
Short Introduction of Implicit Conversion by TIS, Inc.
Short Introduction of Implicit Conversion by TIS, Inc.Short Introduction of Implicit Conversion by TIS, Inc.
Short Introduction of Implicit Conversion by TIS, Inc.
 
ビズリーチ x ScalaMatsuri by BIZREACH, Inc.
ビズリーチ x ScalaMatsuri  by BIZREACH, Inc.ビズリーチ x ScalaMatsuri  by BIZREACH, Inc.
ビズリーチ x ScalaMatsuri by BIZREACH, Inc.
 
sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論
 
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
 

Recently uploaded

App Builder - Hierarchical Data Apps.pptx
App Builder - Hierarchical Data Apps.pptxApp Builder - Hierarchical Data Apps.pptx
App Builder - Hierarchical Data Apps.pptxPoojitha B
 
Embracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio ManagementEmbracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio ManagementOnePlan Solutions
 
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)GDSCNiT
 
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...ISPMAIndia
 
The Game-Changer_ How Software Development Outsource Can Catapult Your Growth...
The Game-Changer_ How Software Development Outsource Can Catapult Your Growth...The Game-Changer_ How Software Development Outsource Can Catapult Your Growth...
The Game-Changer_ How Software Development Outsource Can Catapult Your Growth...emili denli
 
killingcamp longest common subsequence.pdf
killingcamp longest common subsequence.pdfkillingcamp longest common subsequence.pdf
killingcamp longest common subsequence.pdfssuser82c38d
 
SPM 2024 – Overview of and benefits of AI in Product Management
SPM 2024 – Overview of and benefits of AI in Product ManagementSPM 2024 – Overview of and benefits of AI in Product Management
SPM 2024 – Overview of and benefits of AI in Product ManagementISPMAIndia
 
Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Asher Sterkin
 
maximum subarray ppt for killing camp students
maximum subarray ppt for killing camp studentsmaximum subarray ppt for killing camp students
maximum subarray ppt for killing camp studentsssuser82c38d
 
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTSi-engage
 
Self scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloadsSelf scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloadsBram Vogelaar
 
Getting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptxGetting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptxmavinoikein
 
P1 Inspection Types in Municity 5 Smartsheet
P1 Inspection Types in Municity 5 SmartsheetP1 Inspection Types in Municity 5 Smartsheet
P1 Inspection Types in Municity 5 SmartsheetMatthewTHawley
 
"Taking an idea to a Product in Health diagnostics" by Dr. Geetha Manjunath, ...
"Taking an idea to a Product in Health diagnostics" by Dr. Geetha Manjunath, ..."Taking an idea to a Product in Health diagnostics" by Dr. Geetha Manjunath, ...
"Taking an idea to a Product in Health diagnostics" by Dr. Geetha Manjunath, ...ISPMAIndia
 
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...confluent
 
killing camp week 6 problem - maximal matrix.pdf
killing camp week 6 problem - maximal matrix.pdfkilling camp week 6 problem - maximal matrix.pdf
killing camp week 6 problem - maximal matrix.pdfssuser82c38d
 
Sql server types of joins with example.pptx
Sql server types of joins with example.pptxSql server types of joins with example.pptx
Sql server types of joins with example.pptxsameer gaikwad
 
No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!Anthony Dahanne
 
sql ppt for students who preparing for sql
sql ppt for students who preparing for sqlsql ppt for students who preparing for sql
sql ppt for students who preparing for sqlbharatjanadharwarud
 
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A..."Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...ISPMAIndia
 

Recently uploaded (20)

App Builder - Hierarchical Data Apps.pptx
App Builder - Hierarchical Data Apps.pptxApp Builder - Hierarchical Data Apps.pptx
App Builder - Hierarchical Data Apps.pptx
 
Embracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio ManagementEmbracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio Management
 
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
 
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
 
The Game-Changer_ How Software Development Outsource Can Catapult Your Growth...
The Game-Changer_ How Software Development Outsource Can Catapult Your Growth...The Game-Changer_ How Software Development Outsource Can Catapult Your Growth...
The Game-Changer_ How Software Development Outsource Can Catapult Your Growth...
 
killingcamp longest common subsequence.pdf
killingcamp longest common subsequence.pdfkillingcamp longest common subsequence.pdf
killingcamp longest common subsequence.pdf
 
SPM 2024 – Overview of and benefits of AI in Product Management
SPM 2024 – Overview of and benefits of AI in Product ManagementSPM 2024 – Overview of and benefits of AI in Product Management
SPM 2024 – Overview of and benefits of AI in Product Management
 
Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024
 
maximum subarray ppt for killing camp students
maximum subarray ppt for killing camp studentsmaximum subarray ppt for killing camp students
maximum subarray ppt for killing camp students
 
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
 
Self scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloadsSelf scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloads
 
Getting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptxGetting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptx
 
P1 Inspection Types in Municity 5 Smartsheet
P1 Inspection Types in Municity 5 SmartsheetP1 Inspection Types in Municity 5 Smartsheet
P1 Inspection Types in Municity 5 Smartsheet
 
"Taking an idea to a Product in Health diagnostics" by Dr. Geetha Manjunath, ...
"Taking an idea to a Product in Health diagnostics" by Dr. Geetha Manjunath, ..."Taking an idea to a Product in Health diagnostics" by Dr. Geetha Manjunath, ...
"Taking an idea to a Product in Health diagnostics" by Dr. Geetha Manjunath, ...
 
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
 
killing camp week 6 problem - maximal matrix.pdf
killing camp week 6 problem - maximal matrix.pdfkilling camp week 6 problem - maximal matrix.pdf
killing camp week 6 problem - maximal matrix.pdf
 
Sql server types of joins with example.pptx
Sql server types of joins with example.pptxSql server types of joins with example.pptx
Sql server types of joins with example.pptx
 
No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!
 
sql ppt for students who preparing for sql
sql ppt for students who preparing for sqlsql ppt for students who preparing for sql
sql ppt for students who preparing for sql
 
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A..."Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
 

Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by Amitpal Singh

  • 1. Run Scala Faster with GraalVM on any Platform Amitpal Singh Director, Oracle Labs Research & Advanced Development
  • 2. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. - 2
  • 3. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | What is GraalVM ● Next Generation VM that runs multiple languages fast with a single runtime 3 JVM languages Light weight Languages LLVM language
  • 4. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | GraalVM architecture ● Graal and Truffle for a High Performance Multilingual Executable VM Environment 4 Graal Compiler JVM CI (JVM Compiler Interface) Java Hotspot VM Java's AST Interpreter Framework Interface for Writing JIT Compiler in Java Truffle Framework JIT compiler written in Java JavaScript Interpreter Ruby Interpreter Python Interpreter LLVM Interpreter R Interpreter
  • 5. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 5
  • 6. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | GraalVM: The Graal Compiler • Written in Java – Modular, maintainable, and extensible • Comes in two flavors – Graal CE – Graal EE • Advanced optimizations – Partial Escape Analysis (Stadler et al. CGO ‘14) – Path Duplication (Leopoldseder et al. CGO ‘18) – Priority Inlining (Prokopec et al. CGO ‘19) 6 long count = 0, sum = 0; for (int i = 0; i < persons.length; i++) { Person person = persons[i]; int age = person.age; if (person.employment == Employment.EMPLOYED && person.salary > 100_000 && age >= 40) { sum += age; count += 1; } } return (double) sum / count; Arrays.stream(persons) .filter(p -> p.getEmployment() == Employment.EMPLOYED) .filter(p -> p.getSalary() > 100_000) .mapToInt(Person::getAge) .filter(age -> age >= 40).average() .getAsDouble();
  • 7. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 7 GraalVM Enterprise Performance – the benchmarks • There’s a new benchmark called “Renaissance” we developed with 4 universities (Charles University, Università della Svizzera Italiana, Johannes Kepler Institute, & Universidad Privada Boliviana) that is described in a new PLDI paper GraalVM EE has 62 optimization phases vs 35 in CE – better inling, profiling, & vectorization among them Renaissance Benchmark: http://Renaissance.dev SpeedupvsJDK8 0.0 1.0 2.0 3.0 4.0 akka-uct chi-square dec-tree finagle-chirper fj-kmeans gauss-mix movie-lens neo4j-analytics philosophers scrabble streams-mnemonics 1.05681.0871.0417 1.1628 0.9804 1.1236 0.98041.0204 2.7778 0.9709 0.8333 0.9434 1.0871.0309 0.9346 0.7937 1.2048 1.087 0.99970.99640.98520.9709 1.3202 1.587 1.1667 1.6628 1.12751.12361.098 1.3469 3.0833 1.02911.0333 1.9623 1.14131.1443 1.486 1.1667 1.37351.3587 1.0997 1.5275 1.2709 1.0194 GraalVM EE 19.0 GraalVM CE 19.0
  • 8. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 8 GraalVM Enterprise Performance: Scalabench SpeedupvsJDK8 0.00 0.70 1.40 2.10 2.80 apparat factorie kiama scalac scaladoc scalap scalariform scalatest scalaxb specs tmt geomean 1.0713 1.6393 0.9709 0.6579 0.8621 1.1494 1.0204 1.25 1.06381.0638 1.5385 0.9259 1.3805 2 1.0194 1.1908 0.8362 1.3448 1.1939 1.4375 1.2447 1.4043 2.6154 1.6204 GraalVM EE 19.0 GraalVM CE 19.0 GraalVM shows best results on Scala – which is why Twitter uses GraalVM CE
  • 9. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 9 Twitter Team uses Graal compiler for Scala • Twitter VM team uses Graal compiler for their Scala-based microservices; • Resulting in reduced object allocations and improves overall execution speed.
  • 10. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - libraal: Run Scala Faster from the get-go • GraalVM Compiler – written in Java – used as JIT Compiler in HotSpot • Packaged as Native Image – Isolates for each compilation • First run will be on par with C2 10 $ scala Streams On your mark, get set, go! 0 (1065 ms) 1 (329 ms) 2 (149 ms) 3 (107 ms) 4 (106 ms) 5 (81 ms) 6 (125 ms) 7 (51 ms) 8 (34 ms) 9 (33 ms) total: 29999997 (2114 ms) $ scala Streams On your mark, get set, go! 0 (191 ms) 1 (107 ms) 2 (69 ms) 3 (120 ms) 4 (27 ms) 5 (26 ms) 6 (27 ms) 7 (28 ms) 8 (27 ms) 9 (27 ms) total: 29999997 (678 ms) With libgraal With graal.jar
  • 11. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 11 GraalVM for Faster Compilation Scala Compilation NormalizedTime 0 0.25 0.5 0.75 1 Akka Lichess Guardian Front end 0.52 0.65 0.34 0.56 0.8 0.38 0.80.8 0.8 Java GraalVM Bloop Bloop + GraalVM Comparing to Java 8, GraalVM EE, Bloop, Bloop + GraalVM EE
  • 12. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - Graal with HotSpot: Conclusions • Using C2 instead of Graal CE--same as wasting ~7% of the performance – JDK 11+: -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX: +UseJVMCICompiler – JDK 8: Download GraalVM CE and put on PATH and as JAVA_HOME • Using GraalVM EE in production ~35% speedup • Using GraalVM EE for project compilation – Gives a productivity boost 12
  • 13. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - Host VM 13 Native Image: Fast Startup and Low Memory Footprint Application Libraries Java class library Substrate VM Input: Classes of application, libraries, and VM Iterative analysis until fixed point is reached Machine Code Image Heap Output: Native executable or library AOT-compile code and take object heap snapshot Points-to Analysis Run Initializations
  • 14. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - 14 Native Image: Fast Startup and Low Memory Footprint $ scalac HelloWorld.scala $ time scala HelloWorld Hello, World! user 0.070s $ native-image -cp $SCALA_HOME/lib/scala-library.jar:./ HelloWorld $ time ./helloworld Hello, World! user 0.005s
  • 15. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Scala Native via Native Image • Scala Native provides an idiomatic interface • Scala Native can be implemented via GraalVM – Translate Scala Native intrinsics into GraalVM intrinsics – Can be implemented as a simple compiler plugin • All JVM libraries would become available with GraalVM – No need to re-write parts of the JVM ecosystem 15
  • 16. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Performance of Scala Native vs. Native Image • Scala Native Benchmarks running with the immix GC 16 Speedup 0 0.55 1.1 1.65 2.2 DeltaBlue Tracer GCBench Json Bounce Richards 1.31 1.19 1.37 1.13 1.34 2.02 0.96 0.81 1.09 0.97 1.21 0.96 111111 Scala Native 0.3.7 Native Image Native Image PGO
  • 17. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. "17 git clone https://github.com/graalvm/graalvm-demos cd graalvm-demos/scala-days-2018/scalac-native/scala-substitutions sbt package cd ../ $GRAALVM_HOME/bin/native-image -cp $SCALA_HOME/lib/scala-compiler.jar:$SCALA_HOME/lib/ scala-library.jar:$SCALA_HOME/lib/scala-reflect.jar:$PWD/scalac-substitutions/target/scala-2.12/ scalac-substitutions_2.12-0.1.0-SNAPSHOT.jar -H:SubstitutionResources=substitutions.json,substitutions-2.12.json -H:ReflectionConfigurationFiles=scalac-substitutions/reflection-config.json -H:Class=scala.tools.nsc.Main -H:Name=scalac Native scalac
  • 18. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. "18 https://medium.com/graalvm/compiling-scala-faster-with-graalvm-86c5c0857fa3
  • 19. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - Microservice Frameworks: Startup Time Helidon Micronaut Quarkus 0 ms 750 ms 1500 ms 2250 ms 3000 ms 940 ms 2101 ms 988 ms 952 ms 2087 ms 1030 ms 16 ms 37 ms 35 ms Native Image JDK 12 JDK 8 19
  • 20. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - Microservice Frameworks: Memory Footprint Helidon Micronaut Quarkus Maximum Memory Size 0 MB 45 MB 90 MB 135 MB 180 MB 121 MB 180 MB 106 MB 125 MB 172 MB 116 MB 17 MB 41 MB 31 MB Native Image JDK 12 JDK 8 20
  • 21. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - Fast Startup and Low Footprint for the Scala Ecosystem • GraalVM Native Image is ready for wide adoption – Sorted out most of the unsupported features • Try out your framework (e.g., Akka and Play) – Report issues if any – Test it in your CI: GraalVM Native Image is easy to install and test • The GraalVM team actively works with the community 21
  • 22. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Native Image: Profile-Guided Optimizations (PGO) • The Graal compiler is built ground-up with profiles in mind – Collecting profiles is essential for performance of native images • PGO requires running relevant workloads before building an image 22 native-image --pgo- instrument Instrumented Binary native-image --pgo Optimized Binary Profiles (.iprof) Relevant Workloads
  • 23. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | What about Scala Macros? • Scala macros use dynamic class loading – Dynamically loaded by scalac – Not always known at image build time • Current solution – Build a custom native executable for a project with all macros included 23
  • 24. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - Native Image is cool, but what’s more in GraalVM Enterprise? Quarkus Hibernate Benchmark 24 RequestsPerSecond 0 4,500 9,000 13,500 18,000 Cumulative number of requests sent by ApacheBench 1000 10000 100000 1e+06 1e+07 Native Image (EE with PGO) Native Image (CE) JDK 8, Java HotSpot VM Quarkus Hibernate Benchmark After this many requests, improve GC by turning it off & on again We’re working on a better GC too
  • 25. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Native Image: Scala Performance 25 • Benchmarks of Scala command line tools Command Line Tools SpeedupvsJDK8 0 0.35 0.7 1.05 1.4 scalac scalariform scalafmt 1.37 1.24 1.03 0.88 0.68 0.6 Native CE/C2 Native EE/C2
  • 26. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 26
  • 27. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - GraalVM Native Image: Support any Platform via LLVM 27 • Implemented an LLVM backend for GraalVM Native Image – In case Apple starts requiring LLVM for their apps – Easy to port Scala to niche architectures • Using LLVM comes with a price – Moving GC in LLVM is still experimental – Slow at compilation – Slower run-time generated code
  • 28. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Cross-Platform Scala: GraalVM and JavaFX IDE Plugin GluonTools JavaFX mobile Graal VM Native ImageGluon Mobile • JavaFX extensions for mobile • Integration with mobile functionality (e.g. GPS/ camera) • Mobile-specific connectivity Java static libs
  • 29. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - Cross-Platform Scala: GraalVM and JavaFX • Apple does not allow dynamic code on iOS devices – Running HotSpot is not allowed – Java interpreter is allowed, but slow • Graal Native Image compiles Java Bytecode into native iOS code for AMD64 (simulator) and AArch64 (iPhone/iPad) • JavaFX contains Java code and native code – Java code is compiled by Graal Native Image – Native code is available for iOS and Android platforms 29
  • 30. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - Cross-Platform Scala: GraalVM and JavaFX • Maven/Gradle plugins are available for doing – Scala compilation – Native image generation – Linking with required OS-specific tools, libraries, frameworks – Signing apps – Deploying on iOS devices and simulators • Java 11/12/13 apps created for desktop work equally on iOS devices (Android coming soon) 30
  • 31. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Demo: Development Tools 31
  • 32. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | React Native vs JavaFX on GraalVM + More components + Bigger community + Hot Code Updates 32 + Running on the JVM + Better Performance + Faster Startup
  • 33. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Spawning a Vibrant Community • Scala is an awesome language to start new projects – Examples: Spark, Akka and Play • React and Flutter native components are open-source – No reason not to use them on the JVM • Time to spawn a mobile ecosystem on the JVM – Scala would be a good place to start 33
  • 34. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Cross-Platform Scala: Next Steps • Completeness – Support for GC on iOS – Running on Android • Deploying to mobile faster – Use a Java bytecode interpreter for development • Support for Android 34
  • 35. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Conclusions • Don’t waste energy, time, and money – -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler • Time to start JVM-based cross-platform development – Start here: https://github.com/gluonhq/client-samples 35
  • 36. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | GraalVM: Run Programs Faster Anywhere • Scala compilation with GraalVM 1.3x-1.5x faster • Native images of Scala programs – Fast startup and low footprint – Faster than HotSpot JIT compiled code • Try it today – https://www.graalvm.org • Demos available on GitHub – https://github.com/graalvm/graalvm-demos/scala-days-2018 • Blog article explaining the demo and the results – https://medium.com/graalvm 36
  • 37. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | - Questions? 37 www.graalvm.org @graalvm