Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6

E
ESUGESUG
Transpiling Pharo Classes to JS
ECMAScript 5 versus ECMAScript 6
Noury Bouraqadi & Dave Mason
International Workshop on Smalltalk Technologies Lyon, France; August 29th-31st, 2023
100%
Pharo
Javascript
100%
Development Production
Development Production
2
100%
Pharo
Javascript
100%
Development Production
Development Production
3
ECMAScript
5
100%
Pharo
Javascript
100%
Development Production
Development Production
4
ECMAScript
5
ECMAScript
6?
vs
5
EcmaScript 5
● Prototypes Only
● Dynamic Object Structure
● Whitebox Objects
● Reified Functions
● this Pseudo-variable
● Constructor Functions
● new Operator
ES5
+
Class Related Constructs
● Classes Definition
● Class Inheritance
● Instance Methods
● Class Methods (static)
● super Pseudo-variable
EcmaScript 6
Class Transpilation by Example
6
ES6: Class Definition + Instance Methods
7
ES6: Class Methods
8
JS “Instance Side” Object Graph
9
JS “Instance Side” Object Graph
10
new Counter()
JS “Class Side” Object Graph
11
ES5: Class Definition + Instance Methods
12
ES5: Class Methods
13
Subclass Transpilation by Example
14
15
ES6: Subclass Definition
16
ES6: Subclass Overriding Instance Methods
17
ES6: Subclass Methods
18
JS Subclass “Instance Side” Object Graph
19
JS Subclass “Class Side” Object Graph
20
ES5: Subclass Definition
21
ES5: Subclass Instance Methods
22
ES5: Subclass Methods
23
JS Subclass Access Superclass IV
let c1 = Counter.getDefaultInstance();
let c2 = CircularCounter.getDefaultInstance();
c1 === c2; // true!
24
Property Sharing Fix
Same solution for
both ES5 and ES6
25
JS Subclass Access Superclass IV
let c1 = Counter.getDefaultInstance();
let c2 = CircularCounter.getDefaultInstance();
c1 === c2; // false!
● Mac Book Pro
○ CPU 8 Intel Core i9, 2.3 GHz,
○ RAM 32 GB, 2667 MHz DDR4
○ Hard drive 1 TB SSD, PCI-Express with APFS File System
○ Mac OS X Ventura 13.2.1
● Pharo 10
● Pharo VM 100 Darwin x86 64-bit
● JS Targets
○ Node
○ Web Browser
26
Benchmark Procedure
27
Improved Transpilation Time + File Size
Improvement
~8%
Improvement
1% - 5%
28
Significantly Faster Load Time
Improvement
25% - 33%
● 5 warm up runs
● 10 runs
● Richards: 50 iterations / run
● Delta Blue: 300 iterations / run
29
Run-time Benchmark Procedure
30
Improved Runtime Performance
Improvement
3% - 10%
31
Improved Runtime Performance vs Pharo 10
ES6 vs Pharo10
Improvement
16% - 24%
32
Improved Runtime Performance vs Pharo 10
ES6 vs Pharo10
Improvement
35% - 43%
33
Summary
● PharoJS is a viable solution to reuse JS Ecosystem
● Transition from ES5 to ES6 is Beneficial
○ Significantly faster Load time
○ Improved other benchmarks
○ More idiomatic code with ES6
● JS white box model = no encapsulation
○ Generate accessors on the fly for third party classes
● Inherited Instance Variables e.g CircularCounter example
○ Force IV Creation
● Metaclass inheritance for third party classes
○ class X {...} vs class X extends Object {...}
● Support full Pharo is still a Challenge
○ DoesNotUnderstand
○ superclass - subclasses relationship
○ thisContext, become:, …
34
Getting exact Smalltalk Semantics is Still tricky
Develop in Pharo, Run on JavaScript
PharoJS.org
Kindly Supported by
Thanks to all the contributors!
M
IT
License
1 de 35

Recomendados

How to upgrade to MongoDB 4.0 - Percona Europe 2018 por
How to upgrade to MongoDB 4.0 - Percona Europe 2018How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018Antonios Giannopoulos
879 vistas61 diapositivas
Clipper: A Low-Latency Online Prediction Serving System por
Clipper: A Low-Latency Online Prediction Serving SystemClipper: A Low-Latency Online Prediction Serving System
Clipper: A Low-Latency Online Prediction Serving SystemDatabricks
2K vistas70 diapositivas
XML London 2013 - Architecture of xproc.xq an XProc processor por
XML London 2013 - Architecture of xproc.xq an XProc processorXML London 2013 - Architecture of xproc.xq an XProc processor
XML London 2013 - Architecture of xproc.xq an XProc processorjimfuller2009
1.6K vistas40 diapositivas
Into The Box 2018 Ortus Keynote por
Into The Box 2018 Ortus KeynoteInto The Box 2018 Ortus Keynote
Into The Box 2018 Ortus KeynoteOrtus Solutions, Corp
355 vistas130 diapositivas
It's always sunny with OpenJ9 por
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9DanHeidinga
176 vistas70 diapositivas
Rapid Application Development with Cocoon por
Rapid Application Development with CocoonRapid Application Development with Cocoon
Rapid Application Development with Cocoontcurdt
1K vistas32 diapositivas

Más contenido relacionado

Similar a Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6

PharoJS: Hijack the JavaScript Ecosystem por
PharoJS: Hijack the JavaScript EcosystemPharoJS: Hijack the JavaScript Ecosystem
PharoJS: Hijack the JavaScript EcosystemESUG
482 vistas48 diapositivas
Using F# to change the way we work por
Using F# to change the way we workUsing F# to change the way we work
Using F# to change the way we workJon Harrop
4.8K vistas61 diapositivas
XML Amsterdam 2012 Keynote por
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynotejimfuller2009
6.9K vistas87 diapositivas
Upgrading to MongoDB 4.0 from older versions por
Upgrading to MongoDB 4.0 from older versionsUpgrading to MongoDB 4.0 from older versions
Upgrading to MongoDB 4.0 from older versionsAntonios Giannopoulos
9.7K vistas76 diapositivas
Installing OpenedX on premises. Universitat Politecnica de Valencia experiences por
Installing OpenedX on premises. Universitat Politecnica de Valencia experiencesInstalling OpenedX on premises. Universitat Politecnica de Valencia experiences
Installing OpenedX on premises. Universitat Politecnica de Valencia experiencesIgnacio Despujol Zabala
1.5K vistas43 diapositivas
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro por
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo MazzaferroRESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo MazzaferroPyData
2.2K vistas20 diapositivas

Similar a Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6(20)

PharoJS: Hijack the JavaScript Ecosystem por ESUG
PharoJS: Hijack the JavaScript EcosystemPharoJS: Hijack the JavaScript Ecosystem
PharoJS: Hijack the JavaScript Ecosystem
ESUG482 vistas
Using F# to change the way we work por Jon Harrop
Using F# to change the way we workUsing F# to change the way we work
Using F# to change the way we work
Jon Harrop4.8K vistas
XML Amsterdam 2012 Keynote por jimfuller2009
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynote
jimfuller20096.9K vistas
Installing OpenedX on premises. Universitat Politecnica de Valencia experiences por Ignacio Despujol Zabala
Installing OpenedX on premises. Universitat Politecnica de Valencia experiencesInstalling OpenedX on premises. Universitat Politecnica de Valencia experiences
Installing OpenedX on premises. Universitat Politecnica de Valencia experiences
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro por PyData
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo MazzaferroRESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
PyData2.2K vistas
Start with version control and experiments management in machine learning por Mikhail Rozhkov
Start with version control and experiments management in machine learningStart with version control and experiments management in machine learning
Start with version control and experiments management in machine learning
Mikhail Rozhkov95 vistas
Java 9-10 What's New por Nicola Pedot
Java 9-10 What's NewJava 9-10 What's New
Java 9-10 What's New
Nicola Pedot179 vistas
Docker & ECS: Secure Nearline Execution por Brennan Saeta
Docker & ECS: Secure Nearline ExecutionDocker & ECS: Secure Nearline Execution
Docker & ECS: Secure Nearline Execution
Brennan Saeta444 vistas
Drools, jBPM OptaPlanner presentation por Mark Proctor
Drools, jBPM OptaPlanner presentationDrools, jBPM OptaPlanner presentation
Drools, jBPM OptaPlanner presentation
Mark Proctor338 vistas
Scalable Whole-Exome Sequence Data Processing Using Workflow On A Cloud por Paolo Missier
Scalable Whole-Exome Sequence Data Processing Using Workflow On A CloudScalable Whole-Exome Sequence Data Processing Using Workflow On A Cloud
Scalable Whole-Exome Sequence Data Processing Using Workflow On A Cloud
Paolo Missier472 vistas
Terraform modules restructured por Ami Mahloof
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
Ami Mahloof440 vistas
Machine learning and big data @ uber a tale of two systems por Zhenxiao Luo
Machine learning and big data @ uber a tale of two systemsMachine learning and big data @ uber a tale of two systems
Machine learning and big data @ uber a tale of two systems
Zhenxiao Luo2.2K vistas
Thesis Defense (Gwendal DANIEL) - Nov 2017 por Gwendal Daniel
Thesis Defense (Gwendal DANIEL) - Nov 2017Thesis Defense (Gwendal DANIEL) - Nov 2017
Thesis Defense (Gwendal DANIEL) - Nov 2017
Gwendal Daniel474 vistas
Pharo 10 and beyond por ESUG
 Pharo 10 and beyond Pharo 10 and beyond
Pharo 10 and beyond
ESUG126 vistas

Más de ESUG

Workshop: Identifying concept inventories in agile programming por
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
12 vistas16 diapositivas
Technical documentation support in Pharo por
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
49 vistas39 diapositivas
The Pharo Debugger and Debugging tools: Advances and Roadmap por
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
57 vistas44 diapositivas
Sequence: Pipeline modelling in Pharo por
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
87 vistas22 diapositivas
Migration process from monolithic to micro frontend architecture in mobile ap... por
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
23 vistas35 diapositivas
Analyzing Dart Language with Pharo: Report and early results por
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
108 vistas30 diapositivas

Más de ESUG(20)

Workshop: Identifying concept inventories in agile programming por ESUG
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
ESUG12 vistas
Technical documentation support in Pharo por ESUG
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
ESUG49 vistas
The Pharo Debugger and Debugging tools: Advances and Roadmap por ESUG
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
ESUG57 vistas
Sequence: Pipeline modelling in Pharo por ESUG
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
ESUG87 vistas
Migration process from monolithic to micro frontend architecture in mobile ap... por ESUG
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
ESUG23 vistas
Analyzing Dart Language with Pharo: Report and early results por ESUG
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG108 vistas
A Unit Test Metamodel for Test Generation por ESUG
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
ESUG54 vistas
Creating Unit Tests Using Genetic Programming por ESUG
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG49 vistas
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes por ESUG
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
ESUG52 vistas
Exploring GitHub Actions through EGAD: An Experience Report por ESUG
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
ESUG17 vistas
Pharo: a reflective language A first systematic analysis of reflective APIs por ESUG
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
ESUG58 vistas
Garbage Collector Tuning por ESUG
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
ESUG20 vistas
Improving Performance Through Object Lifetime Profiling: the DataFrame Case por ESUG
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
ESUG43 vistas
Pharo DataFrame: Past, Present, and Future por ESUG
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG43 vistas
thisContext in the Debugger por ESUG
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
ESUG36 vistas
Websockets for Fencing Score por ESUG
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
ESUG18 vistas
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript por ESUG
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ESUG46 vistas
Advanced Object- Oriented Design Mooc por ESUG
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
ESUG85 vistas
A New Architecture Reconciling Refactorings and Transformations por ESUG
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
ESUG28 vistas
BioSmalltalk por ESUG
BioSmalltalkBioSmalltalk
BioSmalltalk
ESUG415 vistas

Último

EV Charging App Case por
EV Charging App Case EV Charging App Case
EV Charging App Case iCoderz Solutions
10 vistas1 diapositiva
Understanding HTML terminology por
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminologyartembondar5
8 vistas8 diapositivas
Techstack Ltd at Slush 2023, Ukrainian delegation por
Techstack Ltd at Slush 2023, Ukrainian delegationTechstack Ltd at Slush 2023, Ukrainian delegation
Techstack Ltd at Slush 2023, Ukrainian delegationViktoriiaOpanasenko
7 vistas4 diapositivas
ADDO_2022_CICID_Tom_Halpin.pdf por
ADDO_2022_CICID_Tom_Halpin.pdfADDO_2022_CICID_Tom_Halpin.pdf
ADDO_2022_CICID_Tom_Halpin.pdfTomHalpin9
6 vistas33 diapositivas
FOSSLight Community Day 2023-11-30 por
FOSSLight Community Day 2023-11-30FOSSLight Community Day 2023-11-30
FOSSLight Community Day 2023-11-30Shane Coughlan
8 vistas18 diapositivas
Agile 101 por
Agile 101Agile 101
Agile 101John Valentino
13 vistas20 diapositivas

Último(20)

Understanding HTML terminology por artembondar5
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminology
artembondar58 vistas
ADDO_2022_CICID_Tom_Halpin.pdf por TomHalpin9
ADDO_2022_CICID_Tom_Halpin.pdfADDO_2022_CICID_Tom_Halpin.pdf
ADDO_2022_CICID_Tom_Halpin.pdf
TomHalpin96 vistas
FOSSLight Community Day 2023-11-30 por Shane Coughlan
FOSSLight Community Day 2023-11-30FOSSLight Community Day 2023-11-30
FOSSLight Community Day 2023-11-30
Shane Coughlan8 vistas
Ports-and-Adapters Architecture for Embedded HMI por Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert35 vistas
Introduction to Git Source Control por John Valentino
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source Control
John Valentino8 vistas
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... por Stefan Wolpers
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
Stefan Wolpers44 vistas
Bootstrapping vs Venture Capital.pptx por Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic16 vistas
Transport Management System - Shipment & Container Tracking por Freightoscope
Transport Management System - Shipment & Container TrackingTransport Management System - Shipment & Container Tracking
Transport Management System - Shipment & Container Tracking
Freightoscope 6 vistas
aATP - New Correlation Confirmation Feature.pptx por EsatEsenek1
aATP - New Correlation Confirmation Feature.pptxaATP - New Correlation Confirmation Feature.pptx
aATP - New Correlation Confirmation Feature.pptx
EsatEsenek1222 vistas
Top-5-production-devconMunich-2023.pptx por Tier1 app
Top-5-production-devconMunich-2023.pptxTop-5-production-devconMunich-2023.pptx
Top-5-production-devconMunich-2023.pptx
Tier1 app10 vistas
How Workforce Management Software Empowers SMEs | TraQSuite por TraQSuite
How Workforce Management Software Empowers SMEs | TraQSuiteHow Workforce Management Software Empowers SMEs | TraQSuite
How Workforce Management Software Empowers SMEs | TraQSuite
TraQSuite7 vistas

Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6