SlideShare a Scribd company logo
1 of 39
Is WebAssembly the
killer of JavaScript?
Boyan Mihaylov
@bmihaylov
Codemotion Milan 2015
Birth of JavaScript
@bmihaylov | Codemotion Milan 2015 2
1995
Created by Brendan Eich
in 10 days and released
in Netscape Navigator 2.0
Microsoft hits back
@bmihaylov | Codemotion Milan 2015 4
19961995
Microsoft releases
JScript in IE3
Becoming a standard
@bmihaylov | Codemotion Milan 2015 5
The first edition of
ECMA-262 is released
199719961995
photo: engineering.wix.com
2007-2008199719961995
@bmihaylov | Codemotion Milan 2015 7
The jQuery era
JavaScript goes server-side
@bmihaylov | Codemotion Milan 2015 8
JavaScript conquers the world
@bmihaylov | Codemotion Milan 2015 9
JavaScript
source: github.com
Module counts
@bmihaylov | Codemotion Milan 2015 10
source: www.modulecounts.com
Mobile apps
@bmihaylov | Codemotion Milan 2015 11
JavaScript is everywhere, but…
@bmihaylov | Codemotion Milan 2015 12
We are compiling to JavaScript
@bmihaylov | Codemotion Milan 2015 13
JavaScript
C# (Script#)
Java (GWT)
TypeScript
CoffeeScript
C/C++
@bmihaylov | Codemotion Milan 2015 14
C/C++ emscripten
.js
.js + .html
Node.js
Web Browser
Hello, world
@bmihaylov | Codemotion Milan 2015 15
#include<stdio.h>
int main() {
printf("Welcome to Codemotion");
return 0;
}
function _main() {
var $0 = 0, $vararg_buffer= 0,
label = 0, sp = 0;
sp = STACKTOP;
STACKTOP = STACKTOP + 16|0;
if ((STACKTOP|0) >= (STACK_MAX|0))
abort();
$vararg_buffer = sp; $0 = 0;
(_printf((8|0),($vararg_buffer|0))|0);
STACKTOP = sp;
return 0;
}
1 KB 372 KB
Mozilla and Epic ported Unreal Engine 3 to the Web in 4 days
https://www.youtube.com/watch?v=XsyogXtyU9o
Meet asm.js
Started by Mozilla in 2013
A subset of JavaScript to compile very fast
We know the types, rather than infer them on runtime
Enables ahead-of-time (AOT) compilation
@bmihaylov | Codemotion Milan 2015 17
asm.js examples
@bmihaylov | Codemotion Milan 2015 18
function Circle(stdlib,foreign, heap) {
"use asm";
var pi = +stdlib.Math.PI;
function area(r) {
r = r | 0;
return +(pi * r * r);
}
return { area: area };
}
// create and initialize the heap (64k)
var heap = new ArrayBuffer(0x10000);
init(heap, START, END);
// produce exports object,
// linked to AOT-compiledcode
var circle = Circle(window, null, heap);
// calculatethe area of a circle
circle.area(31);
Performance
@bmihaylov | Codemotion Milan 2015 19
0 2 4 6 8 10 12 14 16 18 20
bullet
zlib
skinning
Firefox Chrome Firefox+asm.js Native
source: http://kripken.github.io/mloc_emscripten_talk/#/28
Issues with asm.js
@bmihaylov | Codemotion Milan 2015` 20
Once VMs optimize for it, the parser becomes the bottleneck
We may want to do some things different than JavaScript allows us
It is backed-up only by Mozilla (so far)
WebAssembly
photo: www.onyxtruth.com
What is WebAssembly?
@bmihaylov | Codemotion Milan 2015 22
Improvement to JavaScript and the browser
A new language
Short name is wasm
Compilation target from other languages
Collaborative effort
@bmihaylov | Codemotion Milan 2015 23
+
many others…
WebAssembly
WebAssembly is not bytecode
@bmihaylov | Codemotion Milan 2015 24
Bytecode is linear and stack-, register-, or SSA-based
WebAssembly is binary representation of an AST
WebAssembly is not versioned
WebAssembly will probably lead to universal VM
Abstract syntax tree
@bmihaylov | Codemotion Milan 2015 25
Text format vs. Binary encoding
View source of a
WebAssembly module
Browser developer tools
(when no source maps exist)
Browsers will NOT parse it
Serialized version of the text
format
The main format used by
browsers
Custom-tailored compression
A possible syntax
@bmihaylov | Codemotion Milan 2015 27
(module
(memory1024 (segment 0 "abcdefghijklmnopqrstuvwxyz"))
(import $print "stdio" "print" (param i32))
(func $good (param $i i32)
(call_import $print (i32.load8_u offset=0(get_local $i))) :: 97 'a'
(call_import $print (i32.load8_u offset=1(get_local $i))) :: 98 'b'
(call_import $print (i32.load8_u offset=2 (get_local $i))) :: 99 'c'
(call_import $print (i32.load8_u offset=25(get_local $i))) :: 122 'z‘
)
(export "good" $good)
(assert_return(invoke "good" (i32.const 0)))
)
How to produce WebAssembly
@bmihaylov | Codemotion Milan 2015 28
Produce binary output programmatically
Write code manually using the textual representation
Compile it from another language
WebAssembly is sandboxed
photo: thenextweb.com
asm.js vs WebAssembly
19
6.3
4.1
3
asm.js WebAssembly
Angry Bots demo
MBs
MBs (compressed)
http://beta.unity3d.com/jonas/AngryBots/
WebAssembly today
@bmihaylov | Codemotion Milan 2015 31
Use emscripten to produce it
Stay as close as possible to asm.js
Uses a polyfill to run in the browser
Is in a prototype phase
JavaScript will survive
photo: deviantart.net
WebAssembly is a new feature
@bmihaylov | Codemotion Milan 2015 33
WebAssembly JavaScript
Bytecode
Machine code
WebAssembly and JavaScript
@bmihaylov | Codemotion Milan 2015 34
WebAssembly JavaScript
Games,
video & image
decoders, etc.
External libraries
(f.x., C/C++)
The future of WebAssembly
@bmihaylov | Codemotion Milan 2015 35
Focus on compilation from C/C++
Debug WebAssembly via the source code used to produce it
Mainly low-level computations
Single Instruction, Multiple Data (SIMD)
@bmihaylov | Codemotion Milan 2015 36
WebAssembly fills in the gaps that would
be awkward to fill with JavaScript.
Eric Elliott
“
”
photo: www.adafruit.com
@bmihaylov | Codemotion Milan 2015 37
We think Swift should be everywhere and
used by everyone.
Craig Federighi
Apple’sWWDC 2015
“
”
@bmihaylov | Codemotion Milan 2015 38
39
Grazie, Milano!
hey@boyan.in
@bmihaylov
After party
@bmihaylov | Codemotion Milan 2015

More Related Content

What's hot

Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Domenic Denicola
 
Build RESTful API Using Express JS
Build RESTful API Using Express JSBuild RESTful API Using Express JS
Build RESTful API Using Express JSCakra Danu Sedayu
 
Javascript Module Patterns
Javascript Module PatternsJavascript Module Patterns
Javascript Module PatternsNicholas Jansma
 
What is JavaScript? Edureka
What is JavaScript? EdurekaWhat is JavaScript? Edureka
What is JavaScript? EdurekaEdureka!
 
WebAssembly Fundamentals
WebAssembly FundamentalsWebAssembly Fundamentals
WebAssembly FundamentalsKnoldus Inc.
 
WebAssembly: In a Nutshell
WebAssembly: In a NutshellWebAssembly: In a Nutshell
WebAssembly: In a NutshellRangHo Lee
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the WebCodeValue
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentationritika1
 
Web assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail SorokovskyWeb assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail SorokovskyValeriia Maliarenko
 
Php Tutorial
Php TutorialPhp Tutorial
Php TutorialSridhar P
 
introduction to Vue.js 3
introduction to Vue.js 3 introduction to Vue.js 3
introduction to Vue.js 3 ArezooKmn
 
Web assembly: a brief overview
Web assembly: a brief overviewWeb assembly: a brief overview
Web assembly: a brief overviewPavlo Iatsiuk
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API07.pallav
 

What's hot (20)

Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
 
Build RESTful API Using Express JS
Build RESTful API Using Express JSBuild RESTful API Using Express JS
Build RESTful API Using Express JS
 
Javascript Module Patterns
Javascript Module PatternsJavascript Module Patterns
Javascript Module Patterns
 
What is JavaScript? Edureka
What is JavaScript? EdurekaWhat is JavaScript? Edureka
What is JavaScript? Edureka
 
WebAssembly Fundamentals
WebAssembly FundamentalsWebAssembly Fundamentals
WebAssembly Fundamentals
 
Java script ppt
Java script pptJava script ppt
Java script ppt
 
WebAssembly: In a Nutshell
WebAssembly: In a NutshellWebAssembly: In a Nutshell
WebAssembly: In a Nutshell
 
Why Vue.js?
Why Vue.js?Why Vue.js?
Why Vue.js?
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the Web
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
 
Web assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail SorokovskyWeb assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail Sorokovsky
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Less vs sass
Less vs sassLess vs sass
Less vs sass
 
Rxjs ngvikings
Rxjs ngvikingsRxjs ngvikings
Rxjs ngvikings
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
introduction to Vue.js 3
introduction to Vue.js 3 introduction to Vue.js 3
introduction to Vue.js 3
 
Vue.js for beginners
Vue.js for beginnersVue.js for beginners
Vue.js for beginners
 
Web assembly: a brief overview
Web assembly: a brief overviewWeb assembly: a brief overview
Web assembly: a brief overview
 
Rust
RustRust
Rust
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 

Viewers also liked

Web assembly 맛보기
Web assembly 맛보기Web assembly 맛보기
Web assembly 맛보기GyeongSeok Seo
 
JavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyJavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyChanghwan Yi
 
War of Native Speed on Web (SITCON2016)
War of Native Speed on Web (SITCON2016)War of Native Speed on Web (SITCON2016)
War of Native Speed on Web (SITCON2016)Min-Yih Hsu
 
Trophy winning-teams Codemotion Milan 2015
Trophy winning-teams Codemotion Milan 2015Trophy winning-teams Codemotion Milan 2015
Trophy winning-teams Codemotion Milan 2015Adam Onishi
 
How to defeat feature gluttony?
How to defeat feature gluttony?How to defeat feature gluttony?
How to defeat feature gluttony?Katarzyna Mrowca
 
Fast Slim Correct: The History and Evolution of JavaScript.
Fast Slim Correct: The History and Evolution of JavaScript.Fast Slim Correct: The History and Evolution of JavaScript.
Fast Slim Correct: The History and Evolution of JavaScript.John Dalziel
 
Js engine performance
Js engine performanceJs engine performance
Js engine performancepaullfc
 
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例National Cheng Kung University
 
Come rendere il proprio prodotto una bomba creandogli una intera community in...
Come rendere il proprio prodotto una bomba creandogli una intera community in...Come rendere il proprio prodotto una bomba creandogli una intera community in...
Come rendere il proprio prodotto una bomba creandogli una intera community in...Codemotion
 
DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...
DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...
DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...Codemotion
 
Virtual machine and javascript engine
Virtual machine and javascript engineVirtual machine and javascript engine
Virtual machine and javascript engineDuoyi Wu
 
Functional Reactive Programming With RxSwift
Functional Reactive Programming With RxSwiftFunctional Reactive Programming With RxSwift
Functional Reactive Programming With RxSwift선협 이
 
Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016
Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016 Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016
Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016 Codemotion
 
The Retail Revolution - Antonio Nappi & Enzo Carrea - Codemotion Milan 2016
The Retail Revolution - Antonio Nappi & Enzo Carrea - Codemotion Milan 2016The Retail Revolution - Antonio Nappi & Enzo Carrea - Codemotion Milan 2016
The Retail Revolution - Antonio Nappi & Enzo Carrea - Codemotion Milan 2016Codemotion
 
"Gridd: Retroenhanced" - what is behind the scenes? - Andrea Tabacco, Lara Gi...
"Gridd: Retroenhanced" - what is behind the scenes? - Andrea Tabacco, Lara Gi..."Gridd: Retroenhanced" - what is behind the scenes? - Andrea Tabacco, Lara Gi...
"Gridd: Retroenhanced" - what is behind the scenes? - Andrea Tabacco, Lara Gi...Codemotion
 

Viewers also liked (20)

Web assembly 맛보기
Web assembly 맛보기Web assembly 맛보기
Web assembly 맛보기
 
A Firefox-on túl is Mozilla
A Firefox-on túl is MozillaA Firefox-on túl is Mozilla
A Firefox-on túl is Mozilla
 
JavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyJavaScript Engine and WebAssembly
JavaScript Engine and WebAssembly
 
WebAssembly
WebAssemblyWebAssembly
WebAssembly
 
The Future of Javascript
The Future of JavascriptThe Future of Javascript
The Future of Javascript
 
War of Native Speed on Web (SITCON2016)
War of Native Speed on Web (SITCON2016)War of Native Speed on Web (SITCON2016)
War of Native Speed on Web (SITCON2016)
 
Trophy winning-teams Codemotion Milan 2015
Trophy winning-teams Codemotion Milan 2015Trophy winning-teams Codemotion Milan 2015
Trophy winning-teams Codemotion Milan 2015
 
How to defeat feature gluttony?
How to defeat feature gluttony?How to defeat feature gluttony?
How to defeat feature gluttony?
 
Merre tart az open office.org projekt
Merre tart az open office.org projektMerre tart az open office.org projekt
Merre tart az open office.org projekt
 
Fast Slim Correct: The History and Evolution of JavaScript.
Fast Slim Correct: The History and Evolution of JavaScript.Fast Slim Correct: The History and Evolution of JavaScript.
Fast Slim Correct: The History and Evolution of JavaScript.
 
Js engine performance
Js engine performanceJs engine performance
Js engine performance
 
淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道 淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道
 
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
 
Come rendere il proprio prodotto una bomba creandogli una intera community in...
Come rendere il proprio prodotto una bomba creandogli una intera community in...Come rendere il proprio prodotto una bomba creandogli una intera community in...
Come rendere il proprio prodotto una bomba creandogli una intera community in...
 
DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...
DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...
DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...
 
Virtual machine and javascript engine
Virtual machine and javascript engineVirtual machine and javascript engine
Virtual machine and javascript engine
 
Functional Reactive Programming With RxSwift
Functional Reactive Programming With RxSwiftFunctional Reactive Programming With RxSwift
Functional Reactive Programming With RxSwift
 
Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016
Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016 Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016
Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016
 
The Retail Revolution - Antonio Nappi & Enzo Carrea - Codemotion Milan 2016
The Retail Revolution - Antonio Nappi & Enzo Carrea - Codemotion Milan 2016The Retail Revolution - Antonio Nappi & Enzo Carrea - Codemotion Milan 2016
The Retail Revolution - Antonio Nappi & Enzo Carrea - Codemotion Milan 2016
 
"Gridd: Retroenhanced" - what is behind the scenes? - Andrea Tabacco, Lara Gi...
"Gridd: Retroenhanced" - what is behind the scenes? - Andrea Tabacco, Lara Gi..."Gridd: Retroenhanced" - what is behind the scenes? - Andrea Tabacco, Lara Gi...
"Gridd: Retroenhanced" - what is behind the scenes? - Andrea Tabacco, Lara Gi...
 

Similar to Is WebAssembly the killer of JavaScript?

Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...
Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...
Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...Voxxed Days Thessaloniki
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
Unbundling the JavaScript module bundler - Codemotion Rome 2018
Unbundling the JavaScript module bundler - Codemotion Rome 2018Unbundling the JavaScript module bundler - Codemotion Rome 2018
Unbundling the JavaScript module bundler - Codemotion Rome 2018Luciano Mammino
 
Unbundling the JavaScript module bundler - Luciano Mammino - Codemotion Rome ...
Unbundling the JavaScript module bundler - Luciano Mammino - Codemotion Rome ...Unbundling the JavaScript module bundler - Luciano Mammino - Codemotion Rome ...
Unbundling the JavaScript module bundler - Luciano Mammino - Codemotion Rome ...Codemotion
 
JavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureJavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureIgalia
 
Objective-Cひとめぐり
Objective-CひとめぐりObjective-Cひとめぐり
Objective-CひとめぐりKenji Kinukawa
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVMJohn Lee
 
Portable, secure, and lightweight: Wasm runtimes and their use-cases - Natali...
Portable, secure, and lightweight: Wasm runtimes and their use-cases - Natali...Portable, secure, and lightweight: Wasm runtimes and their use-cases - Natali...
Portable, secure, and lightweight: Wasm runtimes and their use-cases - Natali...Wey Wey Web
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14Matthieu Garrigues
 
The Ring programming language version 1.5.1 book - Part 46 of 180
The Ring programming language version 1.5.1 book - Part 46 of 180The Ring programming language version 1.5.1 book - Part 46 of 180
The Ring programming language version 1.5.1 book - Part 46 of 180Mahmoud Samir Fayed
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)Domenic Denicola
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmJameel Nabbo
 
Qt Multiplatform development
Qt Multiplatform developmentQt Multiplatform development
Qt Multiplatform developmentSergio Shevchenko
 
Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...Luciano Mammino
 
Altitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & ApplicationsAltitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & ApplicationsFastly
 
2020 03-26 - meet up - zparkio
2020 03-26 - meet up - zparkio2020 03-26 - meet up - zparkio
2020 03-26 - meet up - zparkioLeo Benkel
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Chris Ramsdale
 

Similar to Is WebAssembly the killer of JavaScript? (20)

Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...
Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...
Voxxed Days Thessaloniki 2016 - Web assembly : the browser vm we were waiting...
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
Unbundling the JavaScript module bundler - Codemotion Rome 2018
Unbundling the JavaScript module bundler - Codemotion Rome 2018Unbundling the JavaScript module bundler - Codemotion Rome 2018
Unbundling the JavaScript module bundler - Codemotion Rome 2018
 
Unbundling the JavaScript module bundler - Luciano Mammino - Codemotion Rome ...
Unbundling the JavaScript module bundler - Luciano Mammino - Codemotion Rome ...Unbundling the JavaScript module bundler - Luciano Mammino - Codemotion Rome ...
Unbundling the JavaScript module bundler - Luciano Mammino - Codemotion Rome ...
 
JavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureJavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and Future
 
Objective-Cひとめぐり
Objective-CひとめぐりObjective-Cひとめぐり
Objective-Cひとめぐり
 
MacRuby, an introduction
MacRuby, an introductionMacRuby, an introduction
MacRuby, an introduction
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVM
 
Portable, secure, and lightweight: Wasm runtimes and their use-cases - Natali...
Portable, secure, and lightweight: Wasm runtimes and their use-cases - Natali...Portable, secure, and lightweight: Wasm runtimes and their use-cases - Natali...
Portable, secure, and lightweight: Wasm runtimes and their use-cases - Natali...
 
20151224-games
20151224-games20151224-games
20151224-games
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14
 
The Ring programming language version 1.5.1 book - Part 46 of 180
The Ring programming language version 1.5.1 book - Part 46 of 180The Ring programming language version 1.5.1 book - Part 46 of 180
The Ring programming language version 1.5.1 book - Part 46 of 180
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholm
 
Qt Multiplatform development
Qt Multiplatform developmentQt Multiplatform development
Qt Multiplatform development
 
Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...
 
Altitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & ApplicationsAltitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & Applications
 
2020 03-26 - meet up - zparkio
2020 03-26 - meet up - zparkio2020 03-26 - meet up - zparkio
2020 03-26 - meet up - zparkio
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
 
Novidades do c# 7 e 8
Novidades do c# 7 e 8Novidades do c# 7 e 8
Novidades do c# 7 e 8
 

More from Boyan Mihaylov

Crafting a robust deployment pipeline in finance
Crafting a robust deployment pipeline in financeCrafting a robust deployment pipeline in finance
Crafting a robust deployment pipeline in financeBoyan Mihaylov
 
Using improv techniques for better agile teams
Using improv techniques for better agile teamsUsing improv techniques for better agile teams
Using improv techniques for better agile teamsBoyan Mihaylov
 
Web assembly brings the web to a new era
Web assembly brings the web to a new eraWeb assembly brings the web to a new era
Web assembly brings the web to a new eraBoyan Mihaylov
 
Showdown CI/CD - TeamCity
Showdown CI/CD - TeamCityShowdown CI/CD - TeamCity
Showdown CI/CD - TeamCityBoyan Mihaylov
 
Stop the internet, i want to go offline
Stop the internet, i want to go offlineStop the internet, i want to go offline
Stop the internet, i want to go offlineBoyan Mihaylov
 
Lean or agile, software architecture is fragile
Lean or agile, software architecture is fragileLean or agile, software architecture is fragile
Lean or agile, software architecture is fragileBoyan Mihaylov
 
Software architecture also needs agile
Software architecture also needs agileSoftware architecture also needs agile
Software architecture also needs agileBoyan Mihaylov
 
Agile software architecture
Agile software architectureAgile software architecture
Agile software architectureBoyan Mihaylov
 
Component-driven development with AngularJS
Component-driven development with AngularJSComponent-driven development with AngularJS
Component-driven development with AngularJSBoyan Mihaylov
 
Bringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJSBringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJSBoyan Mihaylov
 
Identifying methods for measuring emotions
Identifying methods for measuring emotionsIdentifying methods for measuring emotions
Identifying methods for measuring emotionsBoyan Mihaylov
 

More from Boyan Mihaylov (16)

Crafting a robust deployment pipeline in finance
Crafting a robust deployment pipeline in financeCrafting a robust deployment pipeline in finance
Crafting a robust deployment pipeline in finance
 
Using improv techniques for better agile teams
Using improv techniques for better agile teamsUsing improv techniques for better agile teams
Using improv techniques for better agile teams
 
Web assembly brings the web to a new era
Web assembly brings the web to a new eraWeb assembly brings the web to a new era
Web assembly brings the web to a new era
 
Showdown CI/CD - TeamCity
Showdown CI/CD - TeamCityShowdown CI/CD - TeamCity
Showdown CI/CD - TeamCity
 
Stop the internet, i want to go offline
Stop the internet, i want to go offlineStop the internet, i want to go offline
Stop the internet, i want to go offline
 
Shifting to agile
Shifting to agileShifting to agile
Shifting to agile
 
Lean or agile, software architecture is fragile
Lean or agile, software architecture is fragileLean or agile, software architecture is fragile
Lean or agile, software architecture is fragile
 
Software architecture also needs agile
Software architecture also needs agileSoftware architecture also needs agile
Software architecture also needs agile
 
Flux architecture
Flux architectureFlux architecture
Flux architecture
 
AngularJS 2.0
AngularJS 2.0AngularJS 2.0
AngularJS 2.0
 
To SPA or not to SPA
To SPA or not to SPATo SPA or not to SPA
To SPA or not to SPA
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
 
Agile software architecture
Agile software architectureAgile software architecture
Agile software architecture
 
Component-driven development with AngularJS
Component-driven development with AngularJSComponent-driven development with AngularJS
Component-driven development with AngularJS
 
Bringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJSBringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJS
 
Identifying methods for measuring emotions
Identifying methods for measuring emotionsIdentifying methods for measuring emotions
Identifying methods for measuring emotions
 

Recently uploaded

『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxmibuzondetrabajo
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
TRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxTRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxAndrieCagasanAkio
 
IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119APNIC
 
ETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxNIMMANAGANTI RAMAKRISHNA
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Company Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxCompany Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxMario
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 

Recently uploaded (11)

『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptx
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
TRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxTRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptx
 
IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119
 
ETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptx
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Company Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxCompany Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptx
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 

Is WebAssembly the killer of JavaScript?

  • 1. Is WebAssembly the killer of JavaScript? Boyan Mihaylov @bmihaylov Codemotion Milan 2015
  • 2. Birth of JavaScript @bmihaylov | Codemotion Milan 2015 2 1995 Created by Brendan Eich in 10 days and released in Netscape Navigator 2.0
  • 3.
  • 4. Microsoft hits back @bmihaylov | Codemotion Milan 2015 4 19961995 Microsoft releases JScript in IE3
  • 5. Becoming a standard @bmihaylov | Codemotion Milan 2015 5 The first edition of ECMA-262 is released 199719961995
  • 7. @bmihaylov | Codemotion Milan 2015 7 The jQuery era
  • 8. JavaScript goes server-side @bmihaylov | Codemotion Milan 2015 8
  • 9. JavaScript conquers the world @bmihaylov | Codemotion Milan 2015 9 JavaScript source: github.com
  • 10. Module counts @bmihaylov | Codemotion Milan 2015 10 source: www.modulecounts.com
  • 11. Mobile apps @bmihaylov | Codemotion Milan 2015 11
  • 12. JavaScript is everywhere, but… @bmihaylov | Codemotion Milan 2015 12
  • 13. We are compiling to JavaScript @bmihaylov | Codemotion Milan 2015 13 JavaScript C# (Script#) Java (GWT) TypeScript CoffeeScript C/C++
  • 14. @bmihaylov | Codemotion Milan 2015 14 C/C++ emscripten .js .js + .html Node.js Web Browser
  • 15. Hello, world @bmihaylov | Codemotion Milan 2015 15 #include<stdio.h> int main() { printf("Welcome to Codemotion"); return 0; } function _main() { var $0 = 0, $vararg_buffer= 0, label = 0, sp = 0; sp = STACKTOP; STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abort(); $vararg_buffer = sp; $0 = 0; (_printf((8|0),($vararg_buffer|0))|0); STACKTOP = sp; return 0; } 1 KB 372 KB
  • 16. Mozilla and Epic ported Unreal Engine 3 to the Web in 4 days https://www.youtube.com/watch?v=XsyogXtyU9o
  • 17. Meet asm.js Started by Mozilla in 2013 A subset of JavaScript to compile very fast We know the types, rather than infer them on runtime Enables ahead-of-time (AOT) compilation @bmihaylov | Codemotion Milan 2015 17
  • 18. asm.js examples @bmihaylov | Codemotion Milan 2015 18 function Circle(stdlib,foreign, heap) { "use asm"; var pi = +stdlib.Math.PI; function area(r) { r = r | 0; return +(pi * r * r); } return { area: area }; } // create and initialize the heap (64k) var heap = new ArrayBuffer(0x10000); init(heap, START, END); // produce exports object, // linked to AOT-compiledcode var circle = Circle(window, null, heap); // calculatethe area of a circle circle.area(31);
  • 19. Performance @bmihaylov | Codemotion Milan 2015 19 0 2 4 6 8 10 12 14 16 18 20 bullet zlib skinning Firefox Chrome Firefox+asm.js Native source: http://kripken.github.io/mloc_emscripten_talk/#/28
  • 20. Issues with asm.js @bmihaylov | Codemotion Milan 2015` 20 Once VMs optimize for it, the parser becomes the bottleneck We may want to do some things different than JavaScript allows us It is backed-up only by Mozilla (so far)
  • 22. What is WebAssembly? @bmihaylov | Codemotion Milan 2015 22 Improvement to JavaScript and the browser A new language Short name is wasm Compilation target from other languages
  • 23. Collaborative effort @bmihaylov | Codemotion Milan 2015 23 + many others… WebAssembly
  • 24. WebAssembly is not bytecode @bmihaylov | Codemotion Milan 2015 24 Bytecode is linear and stack-, register-, or SSA-based WebAssembly is binary representation of an AST WebAssembly is not versioned WebAssembly will probably lead to universal VM
  • 25. Abstract syntax tree @bmihaylov | Codemotion Milan 2015 25
  • 26. Text format vs. Binary encoding View source of a WebAssembly module Browser developer tools (when no source maps exist) Browsers will NOT parse it Serialized version of the text format The main format used by browsers Custom-tailored compression
  • 27. A possible syntax @bmihaylov | Codemotion Milan 2015 27 (module (memory1024 (segment 0 "abcdefghijklmnopqrstuvwxyz")) (import $print "stdio" "print" (param i32)) (func $good (param $i i32) (call_import $print (i32.load8_u offset=0(get_local $i))) :: 97 'a' (call_import $print (i32.load8_u offset=1(get_local $i))) :: 98 'b' (call_import $print (i32.load8_u offset=2 (get_local $i))) :: 99 'c' (call_import $print (i32.load8_u offset=25(get_local $i))) :: 122 'z‘ ) (export "good" $good) (assert_return(invoke "good" (i32.const 0))) )
  • 28. How to produce WebAssembly @bmihaylov | Codemotion Milan 2015 28 Produce binary output programmatically Write code manually using the textual representation Compile it from another language
  • 30. asm.js vs WebAssembly 19 6.3 4.1 3 asm.js WebAssembly Angry Bots demo MBs MBs (compressed) http://beta.unity3d.com/jonas/AngryBots/
  • 31. WebAssembly today @bmihaylov | Codemotion Milan 2015 31 Use emscripten to produce it Stay as close as possible to asm.js Uses a polyfill to run in the browser Is in a prototype phase
  • 33. WebAssembly is a new feature @bmihaylov | Codemotion Milan 2015 33 WebAssembly JavaScript Bytecode Machine code
  • 34. WebAssembly and JavaScript @bmihaylov | Codemotion Milan 2015 34 WebAssembly JavaScript Games, video & image decoders, etc. External libraries (f.x., C/C++)
  • 35. The future of WebAssembly @bmihaylov | Codemotion Milan 2015 35 Focus on compilation from C/C++ Debug WebAssembly via the source code used to produce it Mainly low-level computations Single Instruction, Multiple Data (SIMD)
  • 36. @bmihaylov | Codemotion Milan 2015 36 WebAssembly fills in the gaps that would be awkward to fill with JavaScript. Eric Elliott “ ” photo: www.adafruit.com
  • 37. @bmihaylov | Codemotion Milan 2015 37 We think Swift should be everywhere and used by everyone. Craig Federighi Apple’sWWDC 2015 “ ”
  • 38. @bmihaylov | Codemotion Milan 2015 38