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

Recomendados

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

Más contenido relacionado

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

PharoJS: Hijack the JavaScript Ecosystem von
PharoJS: Hijack the JavaScript EcosystemPharoJS: Hijack the JavaScript Ecosystem
PharoJS: Hijack the JavaScript EcosystemESUG
482 views48 Folien
Using F# to change the way we work von
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 views61 Folien
XML Amsterdam 2012 Keynote von
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynotejimfuller2009
6.9K views87 Folien
Upgrading to MongoDB 4.0 from older versions von
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 views76 Folien
Installing OpenedX on premises. Universitat Politecnica de Valencia experiences von
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 views43 Folien
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro von
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 views20 Folien

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

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

Más de ESUG

Workshop: Identifying concept inventories in agile programming von
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
12 views16 Folien
Technical documentation support in Pharo von
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
31 views39 Folien
The Pharo Debugger and Debugging tools: Advances and Roadmap von
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 views44 Folien
Sequence: Pipeline modelling in Pharo von
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
86 views22 Folien
Migration process from monolithic to micro frontend architecture in mobile ap... von
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 views35 Folien
Analyzing Dart Language with Pharo: Report and early results von
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
107 views30 Folien

Más de ESUG(20)

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

Último

DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation von
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook AutomationDRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook AutomationHCLSoftware
6 views8 Folien
Flask-Python.pptx von
Flask-Python.pptxFlask-Python.pptx
Flask-Python.pptxTriloki Gupta
7 views12 Folien
Airline Booking Software von
Airline Booking SoftwareAirline Booking Software
Airline Booking SoftwareSharmiMehta
7 views26 Folien
SAP FOR TYRE INDUSTRY.pdf von
SAP FOR TYRE INDUSTRY.pdfSAP FOR TYRE INDUSTRY.pdf
SAP FOR TYRE INDUSTRY.pdfVirendra Rai, PMP
28 views3 Folien
How Workforce Management Software Empowers SMEs | TraQSuite von
How Workforce Management Software Empowers SMEs | TraQSuiteHow Workforce Management Software Empowers SMEs | TraQSuite
How Workforce Management Software Empowers SMEs | TraQSuiteTraQSuite
5 views3 Folien
Software evolution understanding: Automatic extraction of software identifier... von
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
10 views33 Folien

Último(20)

DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation von HCLSoftware
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook AutomationDRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
HCLSoftware6 views
Airline Booking Software von SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta7 views
How Workforce Management Software Empowers SMEs | TraQSuite von TraQSuite
How Workforce Management Software Empowers SMEs | TraQSuiteHow Workforce Management Software Empowers SMEs | TraQSuite
How Workforce Management Software Empowers SMEs | TraQSuite
TraQSuite5 views
Software evolution understanding: Automatic extraction of software identifier... von 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...
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports von Ra'Fat Al-Msie'deen
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
Fleet Management Software in India von Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable12 views
Myths and Facts About Hospice Care: Busting Common Misconceptions von Care Coordinations
Myths and Facts About Hospice Care: Busting Common MisconceptionsMyths and Facts About Hospice Care: Busting Common Misconceptions
Myths and Facts About Hospice Care: Busting Common Misconceptions
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with... von sparkfabrik
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik8 views
Top-5-production-devconMunich-2023.pptx von Tier1 app
Top-5-production-devconMunich-2023.pptxTop-5-production-devconMunich-2023.pptx
Top-5-production-devconMunich-2023.pptx
Tier1 app8 views
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... von TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin96 views
Sprint 226 von ManageIQ
Sprint 226Sprint 226
Sprint 226
ManageIQ10 views
JioEngage_Presentation.pptx von admin125455
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptx
admin1254556 views
FIMA 2023 Neo4j & FS - Entity Resolution.pptx von Neo4j
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptx
Neo4j17 views
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action von Márton Kodok
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionGen Apps on Google Cloud PaLM2 and Codey APIs in Action
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action
Márton Kodok15 views
Bootstrapping vs Venture Capital.pptx von Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic14 views

Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6