A type inferred programming language
Scala Lite August 12, 2016
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
Scala Lite August 12, 2016
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction
1/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction 2 ScalaLite
1/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction 2 ScalaLite 3 Benchmarking
1/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation
1/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc
1/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc
2/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
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
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
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc
3/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
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
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc
4/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
Experiments
ARM
ArchLinux FreeBSD
amd64
Archlinux Ubuntu FreeBSD OS X
4/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
Results
5/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
Compile time
1 2 3 4 5 6 S c a l a
V M
p i l e
e l l
l d S c a l a
V M
p i l e
i b S c a l a
L V M
p i l e
e l l
l d S c a l a
L V M
p i l e
i b
Compilation time elpased in seconds,
the lower the better.
Compile 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
5.2 5.3 0.012 0.012
6/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
Run time
50 100 150 200 250 S c a l a
V M
u n
e l l
l d S c a l a
V M
u n
i b S c a l a
L V M
u n
e l l
l d S c a l a
L V M
u n
i b
Run time elpased in seconds,
the lower the better.
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
1.2 232 0.002 0.017
7/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc
8/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
Scanner Parser Semantic checker T ype inferrer Code generator llc compiler assembler Ast T
SAst TAst Machaine executable Assembly LLVM-IR
OCaml OCaml Hindley-Milner OCaml LLVM binding LLVM toolchain platform-dependent gcc compiler Data ow Compiler phases Methods
Compiler front end Compiler back end Scala-- Scala--
8/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc
9/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
9/10
Outline Introduction ScalaLite Benchmarking Implementation Misc
GADT
10/10