Run programs faster anywhere Oleg Šelajev Developer Advocate, GraalVM team, Oracle Labs @shelajev

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Safe Harbor Statement

The following is intended to provide some insight into a line of research in Oracle Labs. 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, and timing of any features or functionality described in connection with any Oracle product or service remains at the sole discretion of Oracle. Any views expressed in this presentation are my own and do not necessarily reflect the views of Oracle.

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 2 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !3 Why GraalVM?

Fast , Scala, Kotlin, Groovy, Clojure...

Instant startup, low footprint

Polyglot & embeddable VM

Interoperability between languages: node.js, Python, Ruby,

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !4 Automatic transformation of interpreters to compilers

Engine integration native and managed

standalone

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !5 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !6 Sulong (LLVM) Truffle Framework

Graal Compiler

Java HotSpot VM

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !7 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !9 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. JavaScrabble.run(); (1.9x)

https://medium.com/graalvm/stream-api-performance-with-graalvm-be6cfe7fbb52

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !11 sbt > clean; compile;

https://medium.com/graalvm/compiling-scala-faster-with-graalvm-86c5c0857fa3

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !12 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !13 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !14 Matrix multiplication

https://www.youtube.com/watch?v=RFF2SfPMfpk

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !15 Matrix multiplication

valhallaBench.Multiply.multiply (lower is better)

JDK 11 (size) Mode Cnt Score Error Units valhallaBench.Multiply.multiply 100 avgt 3 7944.935 ± 1963.931 us/op

JDK11 + Graal (size) Mode Cnt Score Error Units valhallaBench.Multiply.multiply 100 avgt 3 3450.944 ± 1130.123 us/op 2.3x GraalVM EE 1.0-rc8 (size) Mode Cnt Score Error Units valhallaBench.Multiply.multiply 100 avgt 3 3134.066 ± 518.812 us/op 2.5x

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !16 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !17 https://twitter.com/janiszt/status/1091678397523283968 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !19 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. ECMAScript 6 compatibility

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !21 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !22 Graal.js on JDK11

https://github.com/graalvm/graal-js-jdk11-maven-demo

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !23 https://www.youtube.com/watch?v=mRKjWrNJ8DI

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !24 https://medium.com/graalvm/faster-r-with-fastr-4b8db0e0dceb

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !25 Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !26 Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !27 https://medium.com/graalvm/analyzing-the-heap-of-graalvm-polyglot-applications-b9963e68a6a

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !28 Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !29 GraalVM native images

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !30 Native images

• Full AOT compilation to machine code • Works with management • Secure execution (e.g., bounds checks) • Embeddable with native applications

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !31 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !32 Limitations

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !34 https://medium.com/graalvm/compiling-scala-faster-with-graalvm-86c5c0857fa3

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !35 Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !36 High performance, polyglot, language-level virtualization layer…

embeddable across the stack

in native and JVM-based applications.

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !37 https://oracle.github.io/oracle-db-mle/releases/0.2.7/

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | https://medium.com/graalvm/safe-and-sandboxed-execution-of-native-code-f6096b35c360

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | !39 Top 10 Things To Do With GraalVM

1. High-performance modern Java 6. Extend a JVM-based application 2. Low-footprint, fast-startup Java 7. Extend a native application 3. Combine JavaScript, Java, Ruby, and R 8. Java code as a native library 4. Run native languages on the JVM 9. Polyglot in the database 5. Tools that work across all languages 10. Create your own language

medium.com/graalvm/graalvm-ten-things-12d9111f307d

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Why GraalVM?

Fast Java, Scala, Kotlin, Groovy, Clojure...

Instant startup, low footprint

Polyglot & embeddable VM

Interoperability between languages: node.js, Python, Ruby, R

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. !41 Building a Universal VM is a Community Effort

• Test your applications with GraalVM – Documentation and downloads at http://www.graalvm.org • Connect your technology with GraalVM – Integrate GraalVM into your application – Run your own or DSL – Build language-agnostic tools • Join the conversation – Report issues or pull requests on GitHub – [email protected] – Follow @graalvm

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted !42