SlideShare a Scribd company logo
Asm.js introduction
_by Oleksii Prohonnyi
OUT OF SCOPE
No information in this presentation
 WebAssembly
 NaCl / PNaCl
 LLVM
 JavaScript Engines Performance
 AOT compilation process
 OdinMonkey by Mozilla
 Chakra by Microsoft
 V8 by Google
HISTORY
History
 JavaScript is one of the world’s most popular programming languages.
 Back in the day, transpilers (source-to-source compilers) were used to hide
some of JavaScript’s ugly parts, e.g. CoffeeScript, ClojureScript,
TypeScript.
 Transpilers mainly use an existing language (such as C or C++) or, they
define a new language (like CoffeeScript).
 Then, instead of writing JavaScript, you can develop in this other language
that the transpiler converts to JavaScript.
Compiling to JavaScript: Nothing New!
 Google Web Toolkit (GWT), Java to JS
 pyjamas, Python into JS
 Opal, Ruby to JavaScript
 JSIL, .NET to JavaScript
 Scala.js, Scala to JavaScript
 etc.
OVERVIEW
What is asm.js?
 asm.js is a strict subset of JavaScript.
 asm.js takes advantage of some low level JavaScript features like Typed
Arrays.
 It does not use any plugins or modules to run the JavaScript code, making
it backward compatible.
 http://asmjs.org/
HOW IT WORKS
JavaScript vs asm.js
 JavaScript
 asm.js
GENERATORS
Emscripten
 Emscripten is an LLVM-to-JavaScript compiler.
 Emscripten accepts LLVM bytecode and converts them to asm.js
JavaScript.
 Clang could be used to convert C/C++ codes to LLVM.
 http://kripken.github.io/emscripten-site/
Code generation process
Code generation process
1. Create a C/C++ app.
2. Compile it using Clang to generate LLVM bytecode.
3. Pass the bytecode to Emscripten to get the JavaScript code.
 Emscripten performs the last two steps itself.
BROWSER SUPPORT
Browser support
 Mozilla Firefox implements asm.js-specific optimizations, starting with
Firefox 22. OdinMonkey, Mozilla's asm.js ahead-of-time compiler used in
Firefox.
 Microsoft is implementing support for asm.js in Chakra, the JavaScript
engine used by Microsoft Edge, performing validation to produce highly
optimized JIT code.
 The optimizations of Google Chrome's V8 JavaScript engine in Chrome 28
made asm.js benchmarks more than twice as fast as prior versions of
Chrome, although Chrome's V8 does not use ahead-of-time compilation.
Browser support
EXAMPLE
JavaScript snippet
C++ snippet
Code generation
 Install Emscripten (https://github.com/kripken/emscripten/wiki).
 Convert C++ code to asm.js code:
“./emcc -O1 -s ASM_JS=1 ./hello_world.cpp”
 Code execution with node.js:
“node ./a.out.js”
 Download Clang (http://clang.llvm.org/)
 Convert C++ code to bytecode:
“clang ./hello_world.cpp”
Generation result
Performance comparison
REFERENCES
See more
 http://asmjs.org/
 https://github.com/kripken/emscripten
 Big Web App? Compile It! (Alon Zakai / Mozilla)
 Asm.js JavaScript compile target (John Resig / Blog)
 Understanding asm.js (Sitepoint)
 From asm.js to WebAssembly (Brendan Eich / Blog)
 Mozilla Hacks
Asm.js introduction
Oleksii Prohonnyi
facebook.com/oprohonnyi
linkedin.com/in/oprohonnyi

More Related Content

What's hot (20)

PDF
AWS ElasticBeanstalk and Docker
kloia
 
PDF
React Typescript for beginners: Translator app with Microsoft cognitive services
Fabio Biondi
 
PDF
Kompose
Suraj Narwade
 
PDF
Is the order code deploy?
Yoichi Toyota
 
PDF
React starter-kitでとっとと始めるisomorphic開発
Yoichi Toyota
 
PPTX
Grunt to automate JS build
Tejaswita Takawale
 
PDF
Introduction to Node.js
Setyo Nugroho
 
PDF
Angular v2 et plus : le futur du développement d'applications en entreprise
LINAGORA
 
KEY
Javascript integration (3)
cookpadtech
 
ODP
What grunt?
Lucio Martinez
 
PPTX
Grunt - The JavaScript Task Runner
Mohammed Arif
 
PDF
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
LINAGORA
 
PDF
Fixing Gaps. Strengthening the Chromium platform for content blocking
Igalia
 
PDF
TDC2018SP | Trilha Containers - CI/CD com Docker e Drone
tdc-globalcode
 
PDF
Building a deployment pipeline
Noam Shochat
 
PPTX
Introduction to Docker Compose
Prabhas Gupte
 
PDF
BBC's GraphDB (formerly Owlim) AWS Cloud Migration
logomachy
 
PDF
OSDC.no 2015 introduction to node.js workshop
leffen
 
PDF
Angular2 - A story from the trenches
Johannes Rudolph
 
PDF
Effective Git
Konrad Malawski
 
AWS ElasticBeanstalk and Docker
kloia
 
React Typescript for beginners: Translator app with Microsoft cognitive services
Fabio Biondi
 
Kompose
Suraj Narwade
 
Is the order code deploy?
Yoichi Toyota
 
React starter-kitでとっとと始めるisomorphic開発
Yoichi Toyota
 
Grunt to automate JS build
Tejaswita Takawale
 
Introduction to Node.js
Setyo Nugroho
 
Angular v2 et plus : le futur du développement d'applications en entreprise
LINAGORA
 
Javascript integration (3)
cookpadtech
 
What grunt?
Lucio Martinez
 
Grunt - The JavaScript Task Runner
Mohammed Arif
 
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
LINAGORA
 
Fixing Gaps. Strengthening the Chromium platform for content blocking
Igalia
 
TDC2018SP | Trilha Containers - CI/CD com Docker e Drone
tdc-globalcode
 
Building a deployment pipeline
Noam Shochat
 
Introduction to Docker Compose
Prabhas Gupte
 
BBC's GraphDB (formerly Owlim) AWS Cloud Migration
logomachy
 
OSDC.no 2015 introduction to node.js workshop
leffen
 
Angular2 - A story from the trenches
Johannes Rudolph
 
Effective Git
Konrad Malawski
 

Viewers also liked (20)

PPTX
Moment.js overview
Oleksii Prohonnyi
 
PPTX
Utility libraries to make your life easier
Oleksii Prohonnyi
 
PPTX
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
Oleksii Prohonnyi
 
PPTX
Front-end rich JavaScript application creation (Backbone.js)
Oleksii Prohonnyi
 
PPTX
Dive into Angular, part 3: Performance
Oleksii Prohonnyi
 
PPTX
Conference DotJS 2015 Paris review
Oleksii Prohonnyi
 
PPTX
Exploradores.caroes
maryespitia
 
PPTX
Dive into Angular, part 5: Experience
Oleksii Prohonnyi
 
PPT
Разработка веб-сайта. Сайт. Зачем он?
Oleksii Prohonnyi
 
PPTX
Как создать сайт за 2 часа? (Wordpress)
Oleksii Prohonnyi
 
PPTX
Chorme devtools
傑倫 鍾
 
PPTX
OpenLayer's basics
Oleksii Prohonnyi
 
PPTX
Dive into Angular, part 1: Introduction
Oleksii Prohonnyi
 
PPTX
Bower introduction
Oleksii Prohonnyi
 
PDF
Chrome DevTools Awesome 10 Features +1
yoshikawa_t
 
PPTX
Google Chrome DevTools features overview
Oleksii Prohonnyi
 
PPTX
Introduction to D3.js
Oleksii Prohonnyi
 
PPTX
JavaScript Presentation Frameworks and Libraries
Oleksii Prohonnyi
 
PPTX
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
David Voyles
 
PPTX
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
 
Moment.js overview
Oleksii Prohonnyi
 
Utility libraries to make your life easier
Oleksii Prohonnyi
 
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
Oleksii Prohonnyi
 
Front-end rich JavaScript application creation (Backbone.js)
Oleksii Prohonnyi
 
Dive into Angular, part 3: Performance
Oleksii Prohonnyi
 
Conference DotJS 2015 Paris review
Oleksii Prohonnyi
 
Exploradores.caroes
maryespitia
 
Dive into Angular, part 5: Experience
Oleksii Prohonnyi
 
Разработка веб-сайта. Сайт. Зачем он?
Oleksii Prohonnyi
 
Как создать сайт за 2 часа? (Wordpress)
Oleksii Prohonnyi
 
Chorme devtools
傑倫 鍾
 
OpenLayer's basics
Oleksii Prohonnyi
 
Dive into Angular, part 1: Introduction
Oleksii Prohonnyi
 
Bower introduction
Oleksii Prohonnyi
 
Chrome DevTools Awesome 10 Features +1
yoshikawa_t
 
Google Chrome DevTools features overview
Oleksii Prohonnyi
 
Introduction to D3.js
Oleksii Prohonnyi
 
JavaScript Presentation Frameworks and Libraries
Oleksii Prohonnyi
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
David Voyles
 
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
 
Ad

Similar to Asm.js introduction (20)

PDF
Turbocharging Client-Side Processing: Leveraging asm.js
FITC
 
PPTX
C++ on the Web: Run your big 3D game in the browser
Andre Weissflog
 
PDF
Emscripten - compile your C/C++ to JavaScript
穎睿 梁
 
ODP
An Introduction to WebAssembly
Daniel Budden
 
PDF
Minko - Build WebGL applications with C++ and asm.js
Minko3D
 
PPTX
WebAssembly: In a Nutshell
RangHo Lee
 
PDF
Always bet on JS - Finjs.io NYC 2016
Brendan Eich
 
PDF
Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...
Voxxed Days Thessaloniki
 
PDF
From C++ to JS via Emscripten
TomNickson
 
PPTX
C++ for the Web
Patrick Charrier
 
PDF
Boyan Mihaylov - Is web assembly the killer of javascript
Codemotion
 
PDF
Is WebAssembly the killer of JavaScript?
Boyan Mihaylov
 
PDF
WebAssembly - kolejny buzzword, czy (r)ewolucja?
Brainhub
 
PPTX
WebAssembly WASM Introduction Presentation
Brad Beiermann
 
PPT
Web assembly overview by Mikhail Sorokovsky
Valeriia Maliarenko
 
PDF
Web (dis)assembly
Shakacon
 
PPTX
Web assembly: a brief overview
Pavlo Iatsiuk
 
PDF
Emscripten, asm.js, and billions of math ops
Luka Zakrajšek
 
PDF
Wasm intro
Elifarley Cruz
 
PDF
Web assembly for the masses
Sendil Kumar
 
Turbocharging Client-Side Processing: Leveraging asm.js
FITC
 
C++ on the Web: Run your big 3D game in the browser
Andre Weissflog
 
Emscripten - compile your C/C++ to JavaScript
穎睿 梁
 
An Introduction to WebAssembly
Daniel Budden
 
Minko - Build WebGL applications with C++ and asm.js
Minko3D
 
WebAssembly: In a Nutshell
RangHo Lee
 
Always bet on JS - Finjs.io NYC 2016
Brendan Eich
 
Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...
Voxxed Days Thessaloniki
 
From C++ to JS via Emscripten
TomNickson
 
C++ for the Web
Patrick Charrier
 
Boyan Mihaylov - Is web assembly the killer of javascript
Codemotion
 
Is WebAssembly the killer of JavaScript?
Boyan Mihaylov
 
WebAssembly - kolejny buzzword, czy (r)ewolucja?
Brainhub
 
WebAssembly WASM Introduction Presentation
Brad Beiermann
 
Web assembly overview by Mikhail Sorokovsky
Valeriia Maliarenko
 
Web (dis)assembly
Shakacon
 
Web assembly: a brief overview
Pavlo Iatsiuk
 
Emscripten, asm.js, and billions of math ops
Luka Zakrajšek
 
Wasm intro
Elifarley Cruz
 
Web assembly for the masses
Sendil Kumar
 
Ad

More from Oleksii Prohonnyi (10)

PPTX
Dive into Angular, part 2: Architecture
Oleksii Prohonnyi
 
PPTX
Code review process with JetBrains UpSource
Oleksii Prohonnyi
 
PPTX
BEM methodology overview
Oleksii Prohonnyi
 
PPTX
Front-end development introduction (JavaScript). Part 2
Oleksii Prohonnyi
 
PPTX
Front-end development introduction (HTML, CSS). Part 1
Oleksii Prohonnyi
 
PPTX
Test-driven development & Behavior-driven development basics
Oleksii Prohonnyi
 
PPTX
JavaScript Coding Guidelines
Oleksii Prohonnyi
 
PPTX
Database Optimization (MySQL)
Oleksii Prohonnyi
 
PPTX
PHPCS (PHP Code Sniffer)
Oleksii Prohonnyi
 
PPTX
Usability of UI Design (motivation, heuristics, tools)
Oleksii Prohonnyi
 
Dive into Angular, part 2: Architecture
Oleksii Prohonnyi
 
Code review process with JetBrains UpSource
Oleksii Prohonnyi
 
BEM methodology overview
Oleksii Prohonnyi
 
Front-end development introduction (JavaScript). Part 2
Oleksii Prohonnyi
 
Front-end development introduction (HTML, CSS). Part 1
Oleksii Prohonnyi
 
Test-driven development & Behavior-driven development basics
Oleksii Prohonnyi
 
JavaScript Coding Guidelines
Oleksii Prohonnyi
 
Database Optimization (MySQL)
Oleksii Prohonnyi
 
PHPCS (PHP Code Sniffer)
Oleksii Prohonnyi
 
Usability of UI Design (motivation, heuristics, tools)
Oleksii Prohonnyi
 

Recently uploaded (20)

PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Tally software_Introduction_Presentation
AditiBansal54083
 

Asm.js introduction

  • 3. No information in this presentation  WebAssembly  NaCl / PNaCl  LLVM  JavaScript Engines Performance  AOT compilation process  OdinMonkey by Mozilla  Chakra by Microsoft  V8 by Google
  • 5. History  JavaScript is one of the world’s most popular programming languages.  Back in the day, transpilers (source-to-source compilers) were used to hide some of JavaScript’s ugly parts, e.g. CoffeeScript, ClojureScript, TypeScript.  Transpilers mainly use an existing language (such as C or C++) or, they define a new language (like CoffeeScript).  Then, instead of writing JavaScript, you can develop in this other language that the transpiler converts to JavaScript.
  • 6. Compiling to JavaScript: Nothing New!  Google Web Toolkit (GWT), Java to JS  pyjamas, Python into JS  Opal, Ruby to JavaScript  JSIL, .NET to JavaScript  Scala.js, Scala to JavaScript  etc.
  • 8. What is asm.js?  asm.js is a strict subset of JavaScript.  asm.js takes advantage of some low level JavaScript features like Typed Arrays.  It does not use any plugins or modules to run the JavaScript code, making it backward compatible.  http://asmjs.org/
  • 10. JavaScript vs asm.js  JavaScript  asm.js
  • 12. Emscripten  Emscripten is an LLVM-to-JavaScript compiler.  Emscripten accepts LLVM bytecode and converts them to asm.js JavaScript.  Clang could be used to convert C/C++ codes to LLVM.  http://kripken.github.io/emscripten-site/
  • 14. Code generation process 1. Create a C/C++ app. 2. Compile it using Clang to generate LLVM bytecode. 3. Pass the bytecode to Emscripten to get the JavaScript code.  Emscripten performs the last two steps itself.
  • 16. Browser support  Mozilla Firefox implements asm.js-specific optimizations, starting with Firefox 22. OdinMonkey, Mozilla's asm.js ahead-of-time compiler used in Firefox.  Microsoft is implementing support for asm.js in Chakra, the JavaScript engine used by Microsoft Edge, performing validation to produce highly optimized JIT code.  The optimizations of Google Chrome's V8 JavaScript engine in Chrome 28 made asm.js benchmarks more than twice as fast as prior versions of Chrome, although Chrome's V8 does not use ahead-of-time compilation.
  • 21. Code generation  Install Emscripten (https://github.com/kripken/emscripten/wiki).  Convert C++ code to asm.js code: “./emcc -O1 -s ASM_JS=1 ./hello_world.cpp”  Code execution with node.js: “node ./a.out.js”  Download Clang (http://clang.llvm.org/)  Convert C++ code to bytecode: “clang ./hello_world.cpp”
  • 25. See more  http://asmjs.org/  https://github.com/kripken/emscripten  Big Web App? Compile It! (Alon Zakai / Mozilla)  Asm.js JavaScript compile target (John Resig / Blog)  Understanding asm.js (Sitepoint)  From asm.js to WebAssembly (Brendan Eich / Blog)  Mozilla Hacks