SlideShare a Scribd company logo
1 of 15
Download to read offline
ECMAScript Harmony:
Rise of the Compilers
Brendan Eich
Fluent 2015
Solar System of JS
Hats off to @shaunlebron — and to ClojureScript
Paris
Where ES6 was approved by Ecma TC39
(but not in this building)
Inria Paris Roof Deck
Our view when we voted ES6 through TC39
What Can JS do?
What JS Can’t Do
• 64-bit integers (COMING IN ES7 <3<3<3)
• Safe stack allocation (e.g. as in Rust)
• Compilers can use a typed array, but slowly
• Mixing objects and primitives in typed arrays
• Proposed for ES7/2016 via typed objects
• Shared memory threads (as in C++)
Don’t Threads Suck?
• Yes — but not compiling C++ to
JS sucks worse
• And C++ has threads
• Emscripten all the C++ things
• Other “Blub to JS” compilers
require threads too
• No shared DOM or main thread
memory
Typed Arrays (ES6)
Originated in WebGL
Copy, or
Hand Off
You can copy a typed array,
and you can hand off its
buffer memory across a
Web Worker boundary.
But in HTML5, you cannot
share memory among
workers — UNTIL NOW!
SharedWorker
var worker = new SharedWorker(filename);
const sentMessage = "ping";
var receivedMessage;
var receivedError;
worker.port.onmessage = function (event) {
receivedMessage = event.data;
};
worker.onerror = function (event) {
receivedError = event.message;
};
worker.port.postMessage(sentMessage);
SharedArrayBuffer
var buffer = new SharedArrayBuffer(1<<20);
var bytes = new SharedUint8Array(buffer);
var words = new SharedUint32Array(buffer);
// etc. as with ES6 typed arrays, but Shared
sharedWorkers.forEach(worker =>
worker.port.postMessage(“start”, [buffer])
);
(draft spec gdoc)
Atomics
Atomics.compareExchange(sta, index, oldvalue,
newvalue)
Atomics.load(sta, index)
Atomics.store(sta, index, value)
Atomics.add(ia, index, value)
Atomics.sub(ia, index, value)
Atomics.and(ia, index, value)
Atomics.or(ia, index, value)
Atomics.xor(ia, index, value)
Atomics.exchange(ia, index, value)
Atomics.isLockFree(size)
Atomics.futexWait(i32a, index, value, timeout)
Atomics.futexWake(i32a, index, count)
Atomics.futexWakeOrRequeue(i32a, index1, count,
value, index2)
In Firefox, + now Chrome
Demos
(PWD, DT2)
Fluent15

More Related Content

Viewers also liked

Viewers also liked (19)

Mozilla's NodeConf talk
Mozilla's NodeConf talkMozilla's NodeConf talk
Mozilla's NodeConf talk
 
JS Responsibilities
JS ResponsibilitiesJS Responsibilities
JS Responsibilities
 
Taysom seminar
Taysom seminarTaysom seminar
Taysom seminar
 
Fluent14
Fluent14Fluent14
Fluent14
 
Capitol js
Capitol jsCapitol js
Capitol js
 
Web futures
Web futuresWeb futures
Web futures
 
JSLOL
JSLOLJSLOL
JSLOL
 
Paren free
Paren freeParen free
Paren free
 
My dotJS Talk
My dotJS TalkMy dotJS Talk
My dotJS Talk
 
dotJS 2015
dotJS 2015dotJS 2015
dotJS 2015
 
Mozilla Research Party Talk
Mozilla Research Party TalkMozilla Research Party Talk
Mozilla Research Party Talk
 
Always bet on JS - Finjs.io NYC 2016
Always bet on JS - Finjs.io NYC 2016Always bet on JS - Finjs.io NYC 2016
Always bet on JS - Finjs.io NYC 2016
 
Extensible Operators and Literals for JavaScript
Extensible Operators and Literals for JavaScriptExtensible Operators and Literals for JavaScript
Extensible Operators and Literals for JavaScript
 
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
 
Value objects in JS - an ES7 work in progress
Value objects in JS - an ES7 work in progressValue objects in JS - an ES7 work in progress
Value objects in JS - an ES7 work in progress
 
Splash
SplashSplash
Splash
 
Txjs talk
Txjs talkTxjs talk
Txjs talk
 
The Same-Origin Saga
The Same-Origin SagaThe Same-Origin Saga
The Same-Origin Saga
 
Int64
Int64Int64
Int64
 

Similar to Fluent15

“Using C#/.NET – “Controversial Topics & Common Mistakes”
“Using C#/.NET – “Controversial Topics & Common Mistakes”“Using C#/.NET – “Controversial Topics & Common Mistakes”
“Using C#/.NET – “Controversial Topics & Common Mistakes”
IT Weekend
 
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
Java Core | Modern Java Concurrency | Martijn Verburg & Ben EvansJava Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
JAX London
 
Rust All Hands Winter 2011
Rust All Hands Winter 2011Rust All Hands Winter 2011
Rust All Hands Winter 2011
Patrick Walton
 

Similar to Fluent15 (20)

Return Oriented Programming
Return Oriented ProgrammingReturn Oriented Programming
Return Oriented Programming
 
Deconstruct 2017: All programmers MUST learn C and Assembly
Deconstruct 2017: All programmers MUST learn C and AssemblyDeconstruct 2017: All programmers MUST learn C and Assembly
Deconstruct 2017: All programmers MUST learn C and Assembly
 
CNIT 127: Ch 18: Source Code Auditing
CNIT 127: Ch 18: Source Code AuditingCNIT 127: Ch 18: Source Code Auditing
CNIT 127: Ch 18: Source Code Auditing
 
“Using C#/.NET – “Controversial Topics & Common Mistakes”
“Using C#/.NET – “Controversial Topics & Common Mistakes”“Using C#/.NET – “Controversial Topics & Common Mistakes”
“Using C#/.NET – “Controversial Topics & Common Mistakes”
 
Ch 18: Source Code Auditing
Ch 18: Source Code AuditingCh 18: Source Code Auditing
Ch 18: Source Code Auditing
 
Case Study on Cray T3E Architecture
Case Study on Cray T3E ArchitectureCase Study on Cray T3E Architecture
Case Study on Cray T3E Architecture
 
Gpgpu intro
Gpgpu introGpgpu intro
Gpgpu intro
 
Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)
 
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
Java Core | Modern Java Concurrency | Martijn Verburg & Ben EvansJava Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
 
CNIT 127 14: Protection Mechanisms
CNIT 127 14: Protection MechanismsCNIT 127 14: Protection Mechanisms
CNIT 127 14: Protection Mechanisms
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
 
gcdtmp
gcdtmpgcdtmp
gcdtmp
 
2CPP02 - C++ Primer
2CPP02 - C++ Primer2CPP02 - C++ Primer
2CPP02 - C++ Primer
 
ES6, A Look Into Your Future
ES6, A Look Into Your FutureES6, A Look Into Your Future
ES6, A Look Into Your Future
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
 
Presentation on C++ programming
Presentation on C++ programming Presentation on C++ programming
Presentation on C++ programming
 
C#_01_CLROverview.ppt
C#_01_CLROverview.pptC#_01_CLROverview.ppt
C#_01_CLROverview.ppt
 
It's always sunny with OpenJ9
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9
 
Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)
 
Rust All Hands Winter 2011
Rust All Hands Winter 2011Rust All Hands Winter 2011
Rust All Hands Winter 2011
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Fluent15

  • 1. ECMAScript Harmony: Rise of the Compilers Brendan Eich Fluent 2015
  • 2. Solar System of JS Hats off to @shaunlebron — and to ClojureScript
  • 3. Paris Where ES6 was approved by Ecma TC39 (but not in this building)
  • 4. Inria Paris Roof Deck Our view when we voted ES6 through TC39
  • 6. What JS Can’t Do • 64-bit integers (COMING IN ES7 <3<3<3) • Safe stack allocation (e.g. as in Rust) • Compilers can use a typed array, but slowly • Mixing objects and primitives in typed arrays • Proposed for ES7/2016 via typed objects • Shared memory threads (as in C++)
  • 7. Don’t Threads Suck? • Yes — but not compiling C++ to JS sucks worse • And C++ has threads • Emscripten all the C++ things • Other “Blub to JS” compilers require threads too • No shared DOM or main thread memory
  • 9. Copy, or Hand Off You can copy a typed array, and you can hand off its buffer memory across a Web Worker boundary. But in HTML5, you cannot share memory among workers — UNTIL NOW!
  • 10. SharedWorker var worker = new SharedWorker(filename); const sentMessage = "ping"; var receivedMessage; var receivedError; worker.port.onmessage = function (event) { receivedMessage = event.data; }; worker.onerror = function (event) { receivedError = event.message; }; worker.port.postMessage(sentMessage);
  • 11. SharedArrayBuffer var buffer = new SharedArrayBuffer(1<<20); var bytes = new SharedUint8Array(buffer); var words = new SharedUint32Array(buffer); // etc. as with ES6 typed arrays, but Shared sharedWorkers.forEach(worker => worker.port.postMessage(“start”, [buffer]) ); (draft spec gdoc)
  • 12. Atomics Atomics.compareExchange(sta, index, oldvalue, newvalue) Atomics.load(sta, index) Atomics.store(sta, index, value) Atomics.add(ia, index, value) Atomics.sub(ia, index, value) Atomics.and(ia, index, value) Atomics.or(ia, index, value) Atomics.xor(ia, index, value) Atomics.exchange(ia, index, value) Atomics.isLockFree(size) Atomics.futexWait(i32a, index, value, timeout) Atomics.futexWake(i32a, index, count) Atomics.futexWakeOrRequeue(i32a, index1, count, value, index2)
  • 13. In Firefox, + now Chrome