Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Salenda
GraalVM

with Groovy & Kotlin
Alberto De Ávila Hernández
A B O U T M E
✴ Team Lead at Salenda
✴ Groovy & Grails dev
✴ Atlassian certified
@alberto_deavila
DISCLAIMER
Goals
G O A L S
✴ Increase our JVM performance
✴ Future of JVM
✴ Programming languagues interoperability
✴ System independence
✴...
✴ GraalVM & features
✴ Show me more code
✴ Limits using GraalVM
✴ Future
S U M M A RY
@alberto_deavila
GraalVM
@alberto_deavila
first... what is Graal?
G R A A L
@alberto_deavila
A dynamic just-in-time compiler that
improves efficiency and speed
G R A A L
@alberto_deavila
A (JIT) compiler for Java transforms
bytecode to machine code
G R A A L
@alberto_deavila Source: https://www.dynatrace.com/news/blog/new-ways-introducing-compiled-code-java-9/
G R A A LV M A R Q U I T E C T U R E
@alberto_deavila Source: https://res.infoq.com/presentations/polyglot-jvm-graal/en/sl...
@alberto_deavila
then... what is GraalVM?
G R A A LV M
@alberto_deavila
Ecosystem and shared runtime offering
performance advantages to multiples
languages
G R A A LV M
@alberto_deavila Source: https://www.graalvm.org/docs/
S U P P O R T E D L A N G U A G E S
@alberto_deavila
✴ Native support: 



✴ Support with installations: Ruby, Python, R
✴...
✴ Graal: the JIT compiler
✴ Graal Polyglot APIs: API to combine
programming languages
✴ Graal SDK: embedding Graal and con...
@alberto_deavila
License
✴ Community edition: free to use
✴ Enterprise edition: Oracle support
G R A A L L I C E N S E
@alberto_deavila
@alberto_deavila
Features
✴ Interoperate with other languages
✴ Includes consoles for JS, R...
✴ Create compiled native images
✴ Run code faster & e...
@alberto_deavila
Interoperability
@alberto_deavila
How can we achieve that?
@alberto_deavila
Truffle
✴ Framework
✴ Allow to create languages interpreters
✴ Based on annotations
✴ Contains common things across any
language
G...
G R A A LV M T R U F F L E
@alberto_deavila Source: https://res.infoq.com/presentations/polyglot-jvm-graal/en/slides/sl13....
G R A A LV M I N T E R O P E R A B I L I T Y
@alberto_deavila
JS RubyPython
Source: https://www.graalvm.org/docs/reference...
G R A A LV M I N T E R O P E R A B I L I T Y
@alberto_deavila
JS RubyPython
Source: https://www.graalvm.org/docs/reference...
G R A A LV M I N T E R O P E R A B I L I T Y
@alberto_deavila
JS RubyPython
Source: https://www.graalvm.org/docs/reference...
G R A A LV M I N T E R O P E R A B I L I T Y
@alberto_deavila
Node with R
Source: https://docs.google.com/presentation/d/1...
✴ Use the appropiate languague for any task
✴ Use libraries from differents languagues
✴ Create apps combining languages
✴...
@alberto_deavila
Native images
✴ Self-contained executable
✴ Fast startup
✴ Low memory consumption
✴ Can generate binary library
✴ Useful for lambdas, co...
G R A A LV M N AT I V E I M A G E S
@alberto_deavila
GraalVM can generate native images BUT
not yet cross platform
Source:...
@alberto_deavila
Ahead-of-time compilation
✴ Analyze statically all code
✴ Compile reachable code
✴ Generates native code
✴ Package it with SubstrateVM
G R A A LV M ...
✴ Framework subset of JVM
✴ No JIT
✴ No optimization
✴ No Graal neither any related with bytecode
✴ Just runtime: GC, thre...
G R A A LV M N AT I V E I M A G E S
@alberto_deavila Source: https://twitter.com/cstancu/status/1103413247305166849
@alberto_deavila
Performance
✴ Depends on code optimizations
✴ Native images startup time is very fast
✴ Each languague has different perfomance
G R A ...
G R A A LV M P E R F O R M A N C E
@alberto_deavila Source: https://lafo.ssw.uni-linz.ac.at/pub/papers/2016_PLDI_Truffle.pdf
G R A A LV M P E R F O R M A N C E
@alberto_deavila Source: https://2017.jokerconf.com/en/2017/talks/3qdblcadmqy0me2uuieqa...
@alberto_deavila
Tools
✴ Use one debugger for all languages, like
chrome-dev-tools
✴ VisualVM to show stats about other
languages
G R A A LV M T ...
G R A A LV M T O O L S
@alberto_deavila Source: https://github.com/chrisseaton/graalvm-ten-things#5-tools-that-work-across...
G R A A LV M T O O L S
@alberto_deavila Source: https://github.com/chrisseaton/graalvm-ten-things#5-tools-that-work-across...
Show me more code
@alberto_deavila
Setup
✴ Download manually
✴ Use SDKman
✴ Docker
G R A A LV M S E T U P
@alberto_deavila
@alberto_deavila
SDKMAN!
✴ Install SDKMAN!
✴ Download GraalVM
G R A A LV M S E T U P W I T H S D K M A N !
@alberto_deavila
@alberto_deavila
Factorial
Limitations
✴ Evaluate static code at compile time
✴ No dynamic code
✴ Some strange exceptions appears
✴ Take long time to generate ex...
@alberto_deavila
Kotlin
K O T L I N L I M I TAT I O N S
@alberto_deavila Source: https://github.com/oracle/graal/issues/366#issuecomment-383547970...
@alberto_deavila
Groovy
✴ Sometimes requires lot of changes / rewrite
✴ No metaprogramming
✴ Closures requires manual config
✴ Grape doesn't work ...
L I M I TAT I O N S
@alberto_deavila Source: https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md
Future
F U T U R E
@alberto_deavila
✴ More languages and tools will be available
✴ Apps with many languages working
✴ A native im...
M O R E I N F O
@alberto_deavila
✴ Offial Doc
✴ List of resources for Graal and related topics
✴ Videos and presentations
...
We are hiring Groovy Devs!
Email me at:
aavila@adaptavist.com
Thank you!
Graalvm with Groovy and Kotlin - Madrid GUG 2019
Upcoming SlideShare
Loading in …5
×

Graalvm with Groovy and Kotlin - Madrid GUG 2019

319 views

Published on

Charla sobre qué es GraalVM, que contiene y cómo usarlo con Groovy y con Kotlin, impartida en Madrid GUG en 2019.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Graalvm with Groovy and Kotlin - Madrid GUG 2019

  1. 1. Salenda GraalVM
 with Groovy & Kotlin Alberto De Ávila Hernández
  2. 2. A B O U T M E ✴ Team Lead at Salenda ✴ Groovy & Grails dev ✴ Atlassian certified @alberto_deavila
  3. 3. DISCLAIMER
  4. 4. Goals
  5. 5. G O A L S ✴ Increase our JVM performance ✴ Future of JVM ✴ Programming languagues interoperability ✴ System independence ✴ Serverless @alberto_deavila
  6. 6. ✴ GraalVM & features ✴ Show me more code ✴ Limits using GraalVM ✴ Future S U M M A RY @alberto_deavila
  7. 7. GraalVM
  8. 8. @alberto_deavila first... what is Graal?
  9. 9. G R A A L @alberto_deavila A dynamic just-in-time compiler that improves efficiency and speed
  10. 10. G R A A L @alberto_deavila A (JIT) compiler for Java transforms bytecode to machine code
  11. 11. G R A A L @alberto_deavila Source: https://www.dynatrace.com/news/blog/new-ways-introducing-compiled-code-java-9/
  12. 12. G R A A LV M A R Q U I T E C T U R E @alberto_deavila Source: https://res.infoq.com/presentations/polyglot-jvm-graal/en/slides/sl13.jpg
  13. 13. @alberto_deavila then... what is GraalVM?
  14. 14. G R A A LV M @alberto_deavila Ecosystem and shared runtime offering performance advantages to multiples languages
  15. 15. G R A A LV M @alberto_deavila Source: https://www.graalvm.org/docs/
  16. 16. S U P P O R T E D L A N G U A G E S @alberto_deavila ✴ Native support: 
 
 ✴ Support with installations: Ruby, Python, R ✴ JVM languages: Groovy, Kotlin, Java... ✴ LLVM: C, C++ ✴ Javascript
  17. 17. ✴ Graal: the JIT compiler ✴ Graal Polyglot APIs: API to combine programming languages ✴ Graal SDK: embedding Graal and configure native images ✴ Oracle HotSpot JVM G R A A LV M @alberto_deavila
  18. 18. @alberto_deavila License
  19. 19. ✴ Community edition: free to use ✴ Enterprise edition: Oracle support G R A A L L I C E N S E @alberto_deavila
  20. 20. @alberto_deavila Features
  21. 21. ✴ Interoperate with other languages ✴ Includes consoles for JS, R... ✴ Create compiled native images ✴ Run code faster & efficiently ✴ Tools to monitor, debug, and profile code G R A A LV M F E AT U R E S @alberto_deavila
  22. 22. @alberto_deavila Interoperability
  23. 23. @alberto_deavila How can we achieve that?
  24. 24. @alberto_deavila Truffle
  25. 25. ✴ Framework ✴ Allow to create languages interpreters ✴ Based on annotations ✴ Contains common things across any language G R A A LV M T R U F F L E @alberto_deavila
  26. 26. G R A A LV M T R U F F L E @alberto_deavila Source: https://res.infoq.com/presentations/polyglot-jvm-graal/en/slides/sl13.jpg
  27. 27. G R A A LV M I N T E R O P E R A B I L I T Y @alberto_deavila JS RubyPython Source: https://www.graalvm.org/docs/reference-manual/polyglot/
  28. 28. G R A A LV M I N T E R O P E R A B I L I T Y @alberto_deavila JS RubyPython Source: https://www.graalvm.org/docs/reference-manual/polyglot/
  29. 29. G R A A LV M I N T E R O P E R A B I L I T Y @alberto_deavila JS RubyPython Source: https://www.graalvm.org/docs/reference-manual/polyglot/
  30. 30. G R A A LV M I N T E R O P E R A B I L I T Y @alberto_deavila Node with R Source: https://docs.google.com/presentation/d/1cBuq4rjaNTOMJOOeGvqnI2TJjWH2VBId7NtVVhXWJkY/edit#slide=id.g495524223b_0_179
  31. 31. ✴ Use the appropiate languague for any task ✴ Use libraries from differents languagues ✴ Create apps combining languages ✴ One environment for all requirements G R A A LV M I N T E R O P E R A B I L I T Y @alberto_deavila
  32. 32. @alberto_deavila Native images
  33. 33. ✴ Self-contained executable ✴ Fast startup ✴ Low memory consumption ✴ Can generate binary library ✴ Useful for lambdas, containers or command line G R A A LV M N AT I V E I M A G E S @alberto_deavila
  34. 34. G R A A LV M N AT I V E I M A G E S @alberto_deavila GraalVM can generate native images BUT not yet cross platform Source: https://github.com/oracle/graal/issues/407
  35. 35. @alberto_deavila Ahead-of-time compilation
  36. 36. ✴ Analyze statically all code ✴ Compile reachable code ✴ Generates native code ✴ Package it with SubstrateVM G R A A LV M A O T C @alberto_deavila
  37. 37. ✴ Framework subset of JVM ✴ No JIT ✴ No optimization ✴ No Graal neither any related with bytecode ✴ Just runtime: GC, threads, I/O, ... G R A A LV M S U B S T R AT E V M @alberto_deavila
  38. 38. G R A A LV M N AT I V E I M A G E S @alberto_deavila Source: https://twitter.com/cstancu/status/1103413247305166849
  39. 39. @alberto_deavila Performance
  40. 40. ✴ Depends on code optimizations ✴ Native images startup time is very fast ✴ Each languague has different perfomance G R A A LV M P E R F O R M A N C E @alberto_deavila
  41. 41. G R A A LV M P E R F O R M A N C E @alberto_deavila Source: https://lafo.ssw.uni-linz.ac.at/pub/papers/2016_PLDI_Truffle.pdf
  42. 42. G R A A LV M P E R F O R M A N C E @alberto_deavila Source: https://2017.jokerconf.com/en/2017/talks/3qdblcadmqy0me2uuieqaq/ Twitter performance using Graal
  43. 43. @alberto_deavila Tools
  44. 44. ✴ Use one debugger for all languages, like chrome-dev-tools ✴ VisualVM to show stats about other languages G R A A LV M T O O L S @alberto_deavila
  45. 45. G R A A LV M T O O L S @alberto_deavila Source: https://github.com/chrisseaton/graalvm-ten-things#5-tools-that-work-across-all-languages
  46. 46. G R A A LV M T O O L S @alberto_deavila Source: https://github.com/chrisseaton/graalvm-ten-things#5-tools-that-work-across-all-languages
  47. 47. Show me more code
  48. 48. @alberto_deavila Setup
  49. 49. ✴ Download manually ✴ Use SDKman ✴ Docker G R A A LV M S E T U P @alberto_deavila
  50. 50. @alberto_deavila SDKMAN!
  51. 51. ✴ Install SDKMAN! ✴ Download GraalVM G R A A LV M S E T U P W I T H S D K M A N ! @alberto_deavila
  52. 52. @alberto_deavila Factorial
  53. 53. Limitations
  54. 54. ✴ Evaluate static code at compile time ✴ No dynamic code ✴ Some strange exceptions appears ✴ Take long time to generate executable ✴ Only for Mac/Linux/Win 64 bits L I M I TAT I O N S @alberto_deavila
  55. 55. @alberto_deavila Kotlin
  56. 56. K O T L I N L I M I TAT I O N S @alberto_deavila Source: https://github.com/oracle/graal/issues/366#issuecomment-383547970 ✴ Almost all features work ✴ Some bugs / features to work, like: ✴ Does not support compilation of non- reducible loops
  57. 57. @alberto_deavila Groovy
  58. 58. ✴ Sometimes requires lot of changes / rewrite ✴ No metaprogramming ✴ Closures requires manual config ✴ Grape doesn't work on standalone native images G R O O V Y L I M I TAT I O N S @alberto_deavila
  59. 59. L I M I TAT I O N S @alberto_deavila Source: https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md
  60. 60. Future
  61. 61. F U T U R E @alberto_deavila ✴ More languages and tools will be available ✴ Apps with many languages working ✴ A native image compatible with all OS ✴ Better perfomance ✴ ...
  62. 62. M O R E I N F O @alberto_deavila ✴ Offial Doc ✴ List of resources for Graal and related topics ✴ Videos and presentations ✴ Top 10 things to do with GraalVM ✴ Kotlin performance with GraalVM
  63. 63. We are hiring Groovy Devs! Email me at: aavila@adaptavist.com
  64. 64. Thank you!

×