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

a type inferred programming language
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

A type inferred programming language

Scala Lite August 12, 2016

slide-2
SLIDE 2

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction

1/10

slide-3
SLIDE 3

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction 2 ScalaLite

1/10

slide-4
SLIDE 4

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction 2 ScalaLite 3 Benchmarking

1/10

slide-5
SLIDE 5

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation

1/10

slide-6
SLIDE 6

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc

1/10

slide-7
SLIDE 7

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc

2/10

slide-8
SLIDE 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

slide-9
SLIDE 9

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc

3/10

slide-10
SLIDE 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

slide-11
SLIDE 11

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc

4/10

slide-12
SLIDE 12

Outline Introduction ScalaLite Benchmarking Implementation Misc

Bencharkmarking

Experiments

ARM

ArchLinux FreeBSD

amd64

Archlinux Ubuntu FreeBSD OS X

4/10

slide-13
SLIDE 13

Outline Introduction ScalaLite Benchmarking Implementation Misc

Bencharkmarking

Results

5/10

slide-14
SLIDE 14

Outline Introduction ScalaLite Benchmarking Implementation Misc

Bencharkmarking

Compile time

1 2 3 4 5 6 S c a l a

  • J

V M

  • c
  • m

p i l e

  • h

e l l

  • w
  • r

l d S c a l a

  • J

V M

  • c
  • m

p i l e

  • f

i b S c a l a

  • L

L V M

  • c
  • m

p i l e

  • h

e l l

  • w
  • r

l d S c a l a

  • L

L V M

  • c
  • m

p i l e

  • f

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

slide-15
SLIDE 15

Outline Introduction ScalaLite Benchmarking Implementation Misc

Bencharkmarking

Run time

50 100 150 200 250 S c a l a

  • J

V M

  • r

u n

  • h

e l l

  • w
  • r

l d S c a l a

  • J

V M

  • r

u n

  • f

i b S c a l a

  • L

L V M

  • r

u n

  • h

e l l

  • w
  • r

l d S c a l a

  • L

L V M

  • r

u n

  • f

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

slide-16
SLIDE 16

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc

8/10

slide-17
SLIDE 17

Outline Introduction ScalaLite Benchmarking Implementation Misc

Implementation

Scanner Parser Semantic checker T ype inferrer Code generator llc compiler assembler Ast T

  • ken

SAst TAst Machaine executable Assembly LLVM-IR

  • camllex
  • camlyacc

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

slide-18
SLIDE 18

Outline Introduction ScalaLite Benchmarking Implementation Misc

Table of Contents

1 Introduction 2 ScalaLite 3 Benchmarking 4 Implementation 5 Misc

9/10

slide-19
SLIDE 19

Outline Introduction ScalaLite Benchmarking Implementation Misc

Attempt of Harness advantage of LLVM’s

  • ptimization power

9/10

slide-20
SLIDE 20

Outline Introduction ScalaLite Benchmarking Implementation Misc

Some ’other . Cool stuff

GADT

10/10