a type inferred programming language
play

A type inferred programming language Scala Lite August 12, 2016 - PowerPoint PPT Presentation

A type inferred programming language Scala Lite August 12, 2016 Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 1/10 Outline Introduction ScalaLite Benchmarking Implementation Misc


  1. A type inferred programming language Scala Lite August 12, 2016

  2. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 1/10

  3. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 2 ScalaLite 1/10

  4. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 2 ScalaLite 3 Benchmarking 1/10

  5. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 1/10

  6. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc 1/10

  7. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc 2/10

  8. Outline Introduction ScalaLite Benchmarking Implementation Misc Introduction Scala −− is a prototype towards to be a full-fledged production-ready functional programming language presently, only support of a small subset of Scala language functionalities. However, it is way faster than JVM-based Scala for both compilation startup time and execution time of the target at runtime leveraging LLVM optimization/analyse. The prototype compiler translates Scala-like source code LLVM IR with OCaml implementation. 2/10

  9. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc 3/10

  10. Outline Introduction ScalaLite Benchmarking Implementation Misc Language Features Language Features Machine code ← Assembly ← LLVM-IR ← OCaml-LLVM-binding ← OCamlYacc ← OCamlLex Basic control flow and scoped varible declaration Basic arithmetic Similar to Scala syntax defining functions and variables Issus: 1 TL;DR 2 Functional ? 3 Type inference ... 4 OOP ? 3/10

  11. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc 4/10

  12. Outline Introduction ScalaLite Benchmarking Implementation Misc Bencharkmarking Experiments ARM ArchLinux FreeBSD amd64 Archlinux Ubuntu FreeBSD OS X 4/10

  13. Outline Introduction ScalaLite Benchmarking Implementation Misc Bencharkmarking Results 5/10

  14. Outline Introduction ScalaLite Benchmarking Implementation Misc Bencharkmarking Compile time Compile time comparison between Scala-JVM and Scala-LLVM. Archlinux, 4.6.4-1, 64bit, jdk1.8.02soft, llvm3.8.1 Compilation time elpased in seconds, gcc6.1.1 20160802, OCaml4.0.3, i3-3120M CPU 2.50GHz,4G 6 5.3 5.2 5 the lower the better. 4 3 2 1 0.012 0.012 0 d d l r l o r o w w - o - o l l e b l l e b h i f h i - - - - f e e e e l l i i l l p p i i m m p p m m o o o o c c - - c c M M - - M M V V V V L L J J L L - - - - a a a a l l l l a a a a c c c c S S S S 6/10

  15. Outline Introduction ScalaLite Benchmarking Implementation Misc Bencharkmarking Run time Run time comparison between Scala-JVM and Scala-LLVM. Archlinux, 4.6.4-1, 64bit, jdk1.8.02soft, llvm3.8.1 gcc6.1.1 20160802, OCaml4.0.3, i3-3120M CPU 2.50GHz,4G Run time elpased in seconds, 250 232 the lower the better. 200 150 100 50 1.2 0.002 0.017 0 d l d r l o r o w w - o - o l e l b l l e b h i f h i - - f n n - - u u n n u u r r - - r r M M - - M M V V V V L L J J L L - - - - a a a a l l l l a a a a c c c c S S S S 7/10

  16. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc 8/10

  17. Outline Introduction ScalaLite Benchmarking Implementation Misc Implementation Methods Compiler phases Data ow ocamllex Scanner T oken Scala-- Parser Ast Compiler ocamlyacc front end OCaml Semantic checker SAst OCaml T ype inferrer TAst Hindley-Milner OCaml Code generator LLVM-IR LLVM binding Scala-- LLVM Assembly llc compiler toolchain Compiler platform-dependent Machaine assembler back end gcc compiler executable 8/10

  18. Outline Introduction ScalaLite Benchmarking Implementation Misc Table of Contents 1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc 9/10

  19. Outline Introduction ScalaLite Benchmarking Implementation Misc Attempt of Harness advantage of LLVM’s optimization power 9/10

  20. Outline Introduction ScalaLite Benchmarking Implementation Misc Some ’other . Cool stuff GADT 10/10

Recommend


More recommend