Top Banner
Pharo VM performance Clement Bera
25

Pharo VM Performance

Jan 28, 2018

Download

Software

Pharo
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Pharo VM Performance

Pharo VM performance

Clement Bera

Page 2: Pharo VM Performance

Myself

• Clément Béra

• 2011-2013: Engineer on the Pharo VM

• 2013-2017: PhD student

• Optimisations of the Pharo VM JIT compiler

Page 3: Pharo VM Performance

0

2

4

6

8

10

12

14

16

Interpreter2005

Stack2009

CogV12010

CogV22011

Spur2014

Sistafuture

Binary tree benchmark

Page 4: Pharo VM Performance

0

2

4

6

8

10

12

14

16

Interpreter2005

Stack2009

CogV12010

CogV22011

Spur2014

Sistafuture

Binary tree benchmarkPharo 5

2016

Page 5: Pharo VM Performance

Plan

• Pharo 5 (stable)

• First time we out benched most competitors

• Pharo 6 (released next week ???)

• Pharo 7

Page 6: Pharo VM Performance

Code execution GC

Page 7: Pharo VM Performance

GC• Pharo 5

• New memory manager Spur

• Pharo 6

• New compactor

• Pharo 7

• Incremental GC ???

Page 8: Pharo VM Performance

Pharo 5: Spur

• Efficient scavenges

• In most applications, most GC time is now in scavenges

Code execution GC

Page 9: Pharo VM Performance

Pharo 6: New compactorLoading a 200 Mb Moose Model in 250 Mb image

February April

Total time 2 min 1 min 2 sec

Time in Full GC 1 min 2 sec

Full GCavg pause 15 sec 0.5 sec

Time in scavenge 15 sec 15 sec

Page 10: Pharo VM Performance

Pharo 6: New compactorLoading a 200 Mb Moose Model in 250 Mb image

February April

Total time 2 min 1 min 2 sec

Time in Full GC 1 min 2 sec

Full GCavg pause 15 sec 0.5 sec

Time in scavenge 15 sec 15 sec <- GC tuning gets

it down to 5 sec

Page 11: Pharo VM Performance

Pharo 7: Incremental GC ??

• Full GC pauses: ~500 ms at ~500Mb

• Java default GC at 200ms soft real time

• Solution

• Incremental marking

• Incremental compaction

Page 12: Pharo VM Performance

Code execution• Pharo 5:

• Spur got 1.8x

• Pharo 6:

• Polishing and micro-optimisations

• Pharo 7:

• Sista gets 1.5x-5x

Page 13: Pharo VM Performance

Pharo 5: Spur 1.8x• Class table speeds-up look-up caches

• New immediate objects

• 22 bits hash

Page 14: Pharo VM Performance

Pharo 6

• Register allocation improvements

• Two path compilation

• Frameless code for setter-like methods

Page 15: Pharo VM Performance

Sista: Pharo 7 ?• Program introspection

• Speculate on types based on previous runs

• Optimize frequently used code

• Deoptimize and reoptimize code incorrectly speculated

Page 16: Pharo VM Performance

Goals

• Program readability

• Performance

Page 17: Pharo VM Performance

Program readability

1 to: array size do: [ :i | (array at: i) yourself ].

array do: [ :elem | elem yourself ].

array do: #yourself.

Page 18: Pharo VM Performance

Program readability

1 to: array size do: [ :i | (array at: i) yourself ].

array do: [ :elem | elem yourself ].

array do: #yourself.

0 2 5 20

87M/sec

28M/sec

13M/sec

3.7M/sec

15M/sec

21M/sec

10M/sec

3.9M/sec

94M/sec

40M/sec

22M/sec

6.5M/sec

Page 19: Pharo VM Performance

Performance

0 1 2 3 4 5 6

A*

ThreadRing

SpectralNorm

JSJSON

BinaryTree

DeltaBlue

Richards

TCAP

Kmeans

Sista

Pharo

Page 20: Pharo VM Performance

Getting stable• Support most development workflow

• Support image recompilation

• Integration has started

Page 21: Pharo VM Performance

In-image design

Smalltalk image

Virtual machine

CogitCompiledCode to native codeMachine-specific optimisations

ScorchCompiledCode to CompiledCodeSmalltalk-specific optimisations

CompiledCode(persisted across start-ups)

native functions(discarded on shut-down)

Baseline JITOptimising JIT

Page 22: Pharo VM Performance

Missing• IDE support

• Debugger

• Methods to show

• Stability, testing

Page 23: Pharo VM Performance

Are you interested ?• Incremental GC ?

• VM performance ?

• VM features ?

• Come and talk to us !

Page 24: Pharo VM Performance

We are looking for…

• Use-cases showing what to improve

• Large real-world benchmarks

• Contributors

• Investment

Page 25: Pharo VM Performance

Conclusion• Pharo 5: Fastest VM

• Pharo 6: Polishing

• Pharo 7: Going further