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 sur 35

Recommandé

How to upgrade to MongoDB 4.0 - Percona Europe 2018 par
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 vues61 diapositives
Clipper: A Low-Latency Online Prediction Serving System par
Clipper: A Low-Latency Online Prediction Serving SystemClipper: A Low-Latency Online Prediction Serving System
Clipper: A Low-Latency Online Prediction Serving SystemDatabricks
2K vues70 diapositives
XML London 2013 - Architecture of xproc.xq an XProc processor par
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 vues40 diapositives
Into The Box 2018 Ortus Keynote par
Into The Box 2018 Ortus KeynoteInto The Box 2018 Ortus Keynote
Into The Box 2018 Ortus KeynoteOrtus Solutions, Corp
355 vues130 diapositives
It's always sunny with OpenJ9 par
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9DanHeidinga
176 vues70 diapositives
Rapid Application Development with Cocoon par
Rapid Application Development with CocoonRapid Application Development with Cocoon
Rapid Application Development with Cocoontcurdt
1K vues32 diapositives

Contenu connexe

Similaire à Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6

PharoJS: Hijack the JavaScript Ecosystem par
PharoJS: Hijack the JavaScript EcosystemPharoJS: Hijack the JavaScript Ecosystem
PharoJS: Hijack the JavaScript EcosystemESUG
481 vues48 diapositives
Using F# to change the way we work par
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 vues61 diapositives
XML Amsterdam 2012 Keynote par
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynotejimfuller2009
6.9K vues87 diapositives
Upgrading to MongoDB 4.0 from older versions par
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 vues76 diapositives
Installing OpenedX on premises. Universitat Politecnica de Valencia experiences par
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 vues43 diapositives
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro par
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 vues20 diapositives

Similaire à Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6(20)

PharoJS: Hijack the JavaScript Ecosystem par ESUG
PharoJS: Hijack the JavaScript EcosystemPharoJS: Hijack the JavaScript Ecosystem
PharoJS: Hijack the JavaScript Ecosystem
ESUG481 vues
Using F# to change the way we work par 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 vues
XML Amsterdam 2012 Keynote par jimfuller2009
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynote
jimfuller20096.9K vues
Installing OpenedX on premises. Universitat Politecnica de Valencia experiences par 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 par 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 vues
Start with version control and experiments management in machine learning par 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 vues
Docker & ECS: Secure Nearline Execution par Brennan Saeta
Docker & ECS: Secure Nearline ExecutionDocker & ECS: Secure Nearline Execution
Docker & ECS: Secure Nearline Execution
Brennan Saeta444 vues
Drools, jBPM OptaPlanner presentation par Mark Proctor
Drools, jBPM OptaPlanner presentationDrools, jBPM OptaPlanner presentation
Drools, jBPM OptaPlanner presentation
Mark Proctor338 vues
Scalable Whole-Exome Sequence Data Processing Using Workflow On A Cloud par 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 vues
Terraform modules restructured par Ami Mahloof
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
Ami Mahloof432 vues
Machine learning and big data @ uber a tale of two systems par 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 vues
Thesis Defense (Gwendal DANIEL) - Nov 2017 par Gwendal Daniel
Thesis Defense (Gwendal DANIEL) - Nov 2017Thesis Defense (Gwendal DANIEL) - Nov 2017
Thesis Defense (Gwendal DANIEL) - Nov 2017
Gwendal Daniel474 vues
Pharo 10 and beyond par ESUG
 Pharo 10 and beyond Pharo 10 and beyond
Pharo 10 and beyond
ESUG126 vues

Plus de ESUG

Workshop: Identifying concept inventories in agile programming par
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
12 vues16 diapositives
Technical documentation support in Pharo par
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
28 vues39 diapositives
The Pharo Debugger and Debugging tools: Advances and Roadmap par
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
56 vues44 diapositives
Sequence: Pipeline modelling in Pharo par
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
86 vues22 diapositives
Migration process from monolithic to micro frontend architecture in mobile ap... par
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
20 vues35 diapositives
Analyzing Dart Language with Pharo: Report and early results par
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
106 vues30 diapositives

Plus de ESUG(20)

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

Dernier

DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the... par
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...Deltares
6 vues22 diapositives
MariaDB stored procedures and why they should be improved par
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improvedFederico Razzoli
8 vues32 diapositives
DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut... par
DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut...DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut...
DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut...Deltares
6 vues28 diapositives
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema par
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDeltares
17 vues13 diapositives
Software evolution understanding: Automatic extraction of software identifier... par
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...Ra'Fat Al-Msie'deen
7 vues33 diapositives
What Can Employee Monitoring Software Do?​ par
What Can Employee Monitoring Software Do?​What Can Employee Monitoring Software Do?​
What Can Employee Monitoring Software Do?​wAnywhere
21 vues11 diapositives

Dernier(20)

DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the... par Deltares
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...
Deltares6 vues
MariaDB stored procedures and why they should be improved par Federico Razzoli
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improved
DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut... par Deltares
DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut...DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut...
DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut...
Deltares6 vues
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema par Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
Deltares17 vues
Software evolution understanding: Automatic extraction of software identifier... par Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
What Can Employee Monitoring Software Do?​ par wAnywhere
What Can Employee Monitoring Software Do?​What Can Employee Monitoring Software Do?​
What Can Employee Monitoring Software Do?​
wAnywhere21 vues
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... par Deltares
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
Deltares9 vues
Generic or specific? Making sensible software design decisions par Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
Software testing company in India.pptx par SakshiPatel82
Software testing company in India.pptxSoftware testing company in India.pptx
Software testing company in India.pptx
SakshiPatel827 vues
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ... par Deltares
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
Deltares10 vues
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge... par Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
Deltares17 vues
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut... par HCLSoftware
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
HCLSoftware6 vues
SUGCON ANZ Presentation V2.1 Final.pptx par Jack Spektor
SUGCON ANZ Presentation V2.1 Final.pptxSUGCON ANZ Presentation V2.1 Final.pptx
SUGCON ANZ Presentation V2.1 Final.pptx
Jack Spektor22 vues
Consulting for Data Monetization Maximizing the Profit Potential of Your Data... par Flexsin
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Flexsin 15 vues
Roadmap y Novedades de producto par Neo4j
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de producto
Neo4j50 vues
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM... par Deltares
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...
Deltares7 vues
DSD-INT 2023 The Danube Hazardous Substances Model - Kovacs par Deltares
DSD-INT 2023 The Danube Hazardous Substances Model - KovacsDSD-INT 2023 The Danube Hazardous Substances Model - Kovacs
DSD-INT 2023 The Danube Hazardous Substances Model - Kovacs
Deltares8 vues
A first look at MariaDB 11.x features and ideas on how to use them par Federico Razzoli
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them

Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6