SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
TURBOCHARGING CLIENT-SIDE PROCESSING

LEVERAGING ASM.JS
Vladimir Vukićević / @vvuk
OVERVIEW
What is asm.js?
Writing asm.js by hand
Using Emscripten
Integrating libraries
What can you do with this
WHAT IS ASM.JS?
vrg=Fot2ra(26)
a
la3Ary378;
fnto mi( {
ucin an)
vra=0 b=0
a
,
;
d {
o
a=8+( < 2 |0
b < )
;
ga> 2 =+[ > 2 +10
[ > ]
ga > ]
.;
b=b+1|0
;
}wie(b|0 <50)
hl (
)
00;
}

This is asm.js. It's JavaScript, with some rigid rules.
asm.js operates on an ArrayBuffer heap
asm.js operates only on numeric values
asm.js can call regular JavaScript
asm.js can be called by regular JavaScript
asm.js provides predictable performance
TWO WAYS TO USE ASM.JS
To bring existing C/C++ apps to the web
Many of the current flashy demos do this
Great for games
Not the focus here
To accelerate processing of JS apps
Leverage existing libraries
Offload and speed up data processing and analysis
WRITING ASM.JS BY HAND
vrha =nwAryufr49)
a ep e raBfe(06;
vram=fnto(tlb frin ha){
a s
ucinsdi, oeg, ep
"s am;
ue s"
vrHAF2=nwsdi.la3Aryha)
a EP3
e tlbFot2ra(ep;
fnto aeaeausfrt ls){
ucin vrgVle(is, at
frt=frt0 ls =ls|;
is
is|; at at0
vrcut=0 vrag=00
a on
; a v
.;
cut=(at-frt > 2
on
ls
is) > ;
wie(frt0 <(at0){
hl (is|) ls|)
ag=ag++EP3[is > 2;
v
v
HAF2frt > ]
frt=frt+40
is
is
|;
}
rtr +ag/+cut0)
eun (v
(on|);
}
rtr {
eun
aeaeaus aeaeaus
vrgVle: vrgVle,
}
;
}wno,{,ha)
(idw } ep;
/ ptsm vle it teha *
* u oe aus no h ep /
vrHAF2=nwFot2ra(ep;
a EP3
e la3Aryha)
fr(a i=0 i<2;+i {
o vr
;
0 +)
HAF2i =i
EP3[] ;
}
/ mk tecl *
* ae h al /
vrag=amaeaeaus0<,2<2;
a v
s.vrgVle(<2 0<)
cnoelgag;
osl.o(v)
WRITING ASM.JS BY HAND
... DOABLE, BUT PAINFUL.
Doable by hand for simple things
e.g., a matrix math library
It's intended to be a compile target
Not just from C/C++!
LLJS can target asm.js
TypeScript is interested
Emscripten for C/C++ source
USING EXISTING LIBRARIES
THROUGH EMSCRIPTEN
LOTS OF EXISTING CODE OUT THERE
For example, open source libraries for...
Computer Vision — OpenCV
Physics — Box2D, Bullet
Compression — zlib, lz4, etc.
Text-to-Speech — eSpeak
Convex Hull Computation — qhull
...
LOTS OF EXISTING CODE OUT THERE
Many already have Emscripten ports
Some have nice JS layers on top
INTEGRATING WITH ASM.JS CODE
1. Get data into asm.js heap
vrcnaDt =cxgtmgDt(,0 w h;
a avsaa
t.eIaeaa0 , , )
/ alct saei amj ha *
* loae pc n s.s ep /
vrhaPr=Mdl.mlo( *h*4;
a ept
oue_alcw
)
vrhaDt =nwUn8ra(EP haPr w*h*4;
a epaa
e itAryHA, ept,
)
/ cp cnaDt.aait ha *
* oy avsaadt no ep /
haDt.e(avsaadt)
epaastcnaDt.aa;

2. Call function(s)
amouedPoesn(ept,w h;
sMdl.orcsighaPr , )

3. Get data out of heap
/ cp dt bc t Iaeaa*
* oy aa ak o mgDt /
cnaDt.aasthaDt)
avsaadt.e(epaa;
/ fe saei amj ha *
* re pc n s.s ep /
Mdl.fe(ept)
oue_rehaPr;
/ da iaedt bc *
* rw mg aa ak /
cxptmgDt(avsaa 0 0;
t.uIaeaacnaDt, , )
INTEGRATING WITH ASM.JS CODE
You have to deal with manual
memory management and allocation
Likely already thinking about it
if you're heavily optimizing your JS
Make some nice wrappers and avoid
having to think about this again
NICE WRAPPERS?
fnto poesmgDt(mgDt){
ucin rcsIaeaaiaeaa
vrw=iaeaawdh h=iaeaahih;
a
mgDt.it,
mgDt.egt
vrhaPr=Mdl.mlo( *h*4;
a ept
oue_alcw
)
vrhaDt =nwUn8ra(EP haPr w*h*4;
a epaa
e itAryHA, ept,
)
haDt.e(avsaadt)
epaastcnaDt.aa;
amouedPoesn(ept,w h;
sMdl.orcsighaPr , )
iaeaadt.e(epaa;
mgDt.aasthaDt)
Mdl.fe(ept)
oue_rehaPr;
}
JUST ANOTHER MODULE
JavaScript App
App Code
EmberJS
jQuery
...

asm.js
code
SOME ODDS AND ENDS
Use Worker Threads
Use async Script Loading
USING WORKER THREADS
Place your asm.js module on a worker
Asynchronous execution, no jank!
Main App code

postMessage ⇒
request
⇐ postMessage
reply

Worker
asm.js
module
(ASIDE) WORKERS ARE AWESOME
And will get even more awesome
We've got lots of APIs coming to workers, including...
WebRTC
WebGL & Canvas 2D
Web Sockets
Web Audio
Synchronous message passing
USING ASYNCHRONOUS SCRIPT LOADING
asm.js code can be large, and parsing and compiling takes time.
<citaycsc"i/ysLbj"<srp>
srp sn r=lbmAmi.s>/cit

Add async. Magic.
In the (very near) future, such compilation will also be cached.
WHAT DO I DO WITH THIS?
Processing/resizing of photos client-side
(color correction, face identification)
Data analysis
(download raw data to client)
WHAT DO I DO WITH THIS?
Face login/confirmation
(WebRTC + UserMedia + canvas)
Add text-to-speech
(read notices in the background)
WHAT DO I DO WITH THIS?
Implement new image (and video?) codecs
(specialized or experimental)
Recognize barcodes
(handy on mobile!)
PERFORMANCE?
"Within 2x of native."
... pretty consistently.
Even on mobile! Take advantage to make mobile apps feel more
like native.
IT'S DANGEROUS TO GO ALONE
You'll need...
Some familiarity with C/C++
(or someone nearby familiar with C/C++)
Emscripten and Emscripten SDK
NOT JUST FOR C/C++

Focus has been on C/C++ due to large body of existing code
Lua, Python, etc. all exist
For example, give users ability to write scripts in Lua
WRAP-UP
asmjs.org
emscripten.org
QUESTIONS?
Vladimir Vukićević / @vvuk

Contenu connexe

Tendances

Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverageTesting NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoveragemlilley
 
(WS14) Sasa Matijasic - Node.js i "novi" web
(WS14) Sasa Matijasic - Node.js i "novi" web(WS14) Sasa Matijasic - Node.js i "novi" web
(WS14) Sasa Matijasic - Node.js i "novi" webWeb::Strategija
 
Algorithm cup 2010
Algorithm cup 2010Algorithm cup 2010
Algorithm cup 2010Wizche
 
appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemappborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemendian7000
 
WebCamp 2016: PHP.Алексей Петров.PHP at Scale: System Architect Toolbox
WebCamp 2016: PHP.Алексей Петров.PHP at Scale: System Architect ToolboxWebCamp 2016: PHP.Алексей Петров.PHP at Scale: System Architect Toolbox
WebCamp 2016: PHP.Алексей Петров.PHP at Scale: System Architect ToolboxWebCamp
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & ExpressChristian Joudrey
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the wayOleg Podsechin
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Comet with node.js and V8
Comet with node.js and V8Comet with node.js and V8
Comet with node.js and V8amix3k
 
Kraken Front-Trends
Kraken Front-TrendsKraken Front-Trends
Kraken Front-TrendsPayPal
 
JavaScript Engines and Event Loop
JavaScript Engines and Event Loop JavaScript Engines and Event Loop
JavaScript Engines and Event Loop Tapan B.K.
 
Node.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterNode.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterSimen Li
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsMarcus Frödin
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 

Tendances (20)

Node ppt
Node pptNode ppt
Node ppt
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
 
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverageTesting NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
 
(WS14) Sasa Matijasic - Node.js i "novi" web
(WS14) Sasa Matijasic - Node.js i "novi" web(WS14) Sasa Matijasic - Node.js i "novi" web
(WS14) Sasa Matijasic - Node.js i "novi" web
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Algorithm cup 2010
Algorithm cup 2010Algorithm cup 2010
Algorithm cup 2010
 
appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemappborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-system
 
WebCamp 2016: PHP.Алексей Петров.PHP at Scale: System Architect Toolbox
WebCamp 2016: PHP.Алексей Петров.PHP at Scale: System Architect ToolboxWebCamp 2016: PHP.Алексей Петров.PHP at Scale: System Architect Toolbox
WebCamp 2016: PHP.Алексей Петров.PHP at Scale: System Architect Toolbox
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & Express
 
JS knowing-nuances
JS knowing-nuancesJS knowing-nuances
JS knowing-nuances
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the way
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Comet with node.js and V8
Comet with node.js and V8Comet with node.js and V8
Comet with node.js and V8
 
Kraken Front-Trends
Kraken Front-TrendsKraken Front-Trends
Kraken Front-Trends
 
JavaScript Engines and Event Loop
JavaScript Engines and Event Loop JavaScript Engines and Event Loop
JavaScript Engines and Event Loop
 
Node.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterNode.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitter
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Node.js - Best practices
Node.js  - Best practicesNode.js  - Best practices
Node.js - Best practices
 
JavaScript Event Loop
JavaScript Event LoopJavaScript Event Loop
JavaScript Event Loop
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 

En vedette

Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...FITC
 
My Type of Life
My Type of LifeMy Type of Life
My Type of LifeFITC
 
From Box to Bots in Minutes
From Box to Bots in MinutesFrom Box to Bots in Minutes
From Box to Bots in MinutesFITC
 
21st Century Crystal Ball
21st Century Crystal Ball21st Century Crystal Ball
21st Century Crystal BallFITC
 
Showing Your Brand Story Online
Showing Your Brand Story OnlineShowing Your Brand Story Online
Showing Your Brand Story OnlineFITC
 
The Browser Is Dead, Long Live The Web!
The Browser Is Dead, Long Live The Web!The Browser Is Dead, Long Live The Web!
The Browser Is Dead, Long Live The Web!FITC
 
Making Work For Humans, Not Consumers
Making Work For Humans, Not ConsumersMaking Work For Humans, Not Consumers
Making Work For Humans, Not ConsumersFITC
 
Managing The Process
Managing The ProcessManaging The Process
Managing The ProcessFITC
 
Neuroscience Brightens Up the Grey Area of User Feedback
Neuroscience Brightens Up the Grey Area of User FeedbackNeuroscience Brightens Up the Grey Area of User Feedback
Neuroscience Brightens Up the Grey Area of User FeedbackFITC
 
Managing Responsive Design Projects
Managing Responsive Design ProjectsManaging Responsive Design Projects
Managing Responsive Design ProjectsFITC
 
Empowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris MillsEmpowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris MillsFITC
 
Building Apps with Ember
Building Apps with EmberBuilding Apps with Ember
Building Apps with EmberFITC
 
Badass Motion Design for Front-end Developers
Badass Motion Design for Front-end DevelopersBadass Motion Design for Front-end Developers
Badass Motion Design for Front-end DevelopersFITC
 
Creating a Smile Worthy World
Creating a Smile Worthy WorldCreating a Smile Worthy World
Creating a Smile Worthy WorldFITC
 
Prolific Minded
Prolific MindedProlific Minded
Prolific MindedFITC
 
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.FITC
 
UX Lessons from the USSR: The Trouble with Manifestos with Erik von Stackelberg
 UX Lessons from the USSR: The Trouble with Manifestos with Erik von Stackelberg UX Lessons from the USSR: The Trouble with Manifestos with Erik von Stackelberg
UX Lessons from the USSR: The Trouble with Manifestos with Erik von StackelbergFITC
 
Here Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript DebuggingHere Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript DebuggingFITC
 
Getting Intimate with Images on Android with James Halpern
Getting Intimate with Images on Android with James HalpernGetting Intimate with Images on Android with James Halpern
Getting Intimate with Images on Android with James HalpernFITC
 
PageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
PageCloud Reimagines The Future of Website Creation with Craig FitzpatrickPageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
PageCloud Reimagines The Future of Website Creation with Craig FitzpatrickFITC
 

En vedette (20)

Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
 
My Type of Life
My Type of LifeMy Type of Life
My Type of Life
 
From Box to Bots in Minutes
From Box to Bots in MinutesFrom Box to Bots in Minutes
From Box to Bots in Minutes
 
21st Century Crystal Ball
21st Century Crystal Ball21st Century Crystal Ball
21st Century Crystal Ball
 
Showing Your Brand Story Online
Showing Your Brand Story OnlineShowing Your Brand Story Online
Showing Your Brand Story Online
 
The Browser Is Dead, Long Live The Web!
The Browser Is Dead, Long Live The Web!The Browser Is Dead, Long Live The Web!
The Browser Is Dead, Long Live The Web!
 
Making Work For Humans, Not Consumers
Making Work For Humans, Not ConsumersMaking Work For Humans, Not Consumers
Making Work For Humans, Not Consumers
 
Managing The Process
Managing The ProcessManaging The Process
Managing The Process
 
Neuroscience Brightens Up the Grey Area of User Feedback
Neuroscience Brightens Up the Grey Area of User FeedbackNeuroscience Brightens Up the Grey Area of User Feedback
Neuroscience Brightens Up the Grey Area of User Feedback
 
Managing Responsive Design Projects
Managing Responsive Design ProjectsManaging Responsive Design Projects
Managing Responsive Design Projects
 
Empowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris MillsEmpowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris Mills
 
Building Apps with Ember
Building Apps with EmberBuilding Apps with Ember
Building Apps with Ember
 
Badass Motion Design for Front-end Developers
Badass Motion Design for Front-end DevelopersBadass Motion Design for Front-end Developers
Badass Motion Design for Front-end Developers
 
Creating a Smile Worthy World
Creating a Smile Worthy WorldCreating a Smile Worthy World
Creating a Smile Worthy World
 
Prolific Minded
Prolific MindedProlific Minded
Prolific Minded
 
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
 
UX Lessons from the USSR: The Trouble with Manifestos with Erik von Stackelberg
 UX Lessons from the USSR: The Trouble with Manifestos with Erik von Stackelberg UX Lessons from the USSR: The Trouble with Manifestos with Erik von Stackelberg
UX Lessons from the USSR: The Trouble with Manifestos with Erik von Stackelberg
 
Here Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript DebuggingHere Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript Debugging
 
Getting Intimate with Images on Android with James Halpern
Getting Intimate with Images on Android with James HalpernGetting Intimate with Images on Android with James Halpern
Getting Intimate with Images on Android with James Halpern
 
PageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
PageCloud Reimagines The Future of Website Creation with Craig FitzpatrickPageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
PageCloud Reimagines The Future of Website Creation with Craig Fitzpatrick
 

Similaire à Turbocharging Client-Side Processing: Leveraging asm.js

Jassa la GeekMeet Bucuresti
Jassa la GeekMeet BucurestiJassa la GeekMeet Bucuresti
Jassa la GeekMeet Bucurestialexnovac
 
Emscripten, asm.js, and billions of math ops
Emscripten, asm.js, and billions of math opsEmscripten, asm.js, and billions of math ops
Emscripten, asm.js, and billions of math opsLuka Zakrajšek
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than YouRobert Cooper
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsMichael Lehmann
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Codemotion
 
Divide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsDivide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsSebastian Springer
 
Everyone loves PHP
Everyone loves PHPEveryone loves PHP
Everyone loves PHPAbhijit Das
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
Survive JavaScript - Strategies and Tricks
Survive JavaScript - Strategies and TricksSurvive JavaScript - Strategies and Tricks
Survive JavaScript - Strategies and TricksJuho Vepsäläinen
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLsintelliyole
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comVan-Duyet Le
 
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...Tom Croucher
 
SFO15-500: VIXL
SFO15-500: VIXLSFO15-500: VIXL
SFO15-500: VIXLLinaro
 
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Emery Berger
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assemblyShakacon
 
Node.js - Advanced Basics
Node.js - Advanced BasicsNode.js - Advanced Basics
Node.js - Advanced BasicsDoug Jones
 

Similaire à Turbocharging Client-Side Processing: Leveraging asm.js (20)

Jassa la GeekMeet Bucuresti
Jassa la GeekMeet BucurestiJassa la GeekMeet Bucuresti
Jassa la GeekMeet Bucuresti
 
Emscripten, asm.js, and billions of math ops
Emscripten, asm.js, and billions of math opsEmscripten, asm.js, and billions of math ops
Emscripten, asm.js, and billions of math ops
 
A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpoint
 
Asm.js introduction
Asm.js introductionAsm.js introduction
Asm.js introduction
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than You
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.js
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
 
Divide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsDivide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.js
 
Everyone loves PHP
Everyone loves PHPEveryone loves PHP
Everyone loves PHP
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
Survive JavaScript - Strategies and Tricks
Survive JavaScript - Strategies and TricksSurvive JavaScript - Strategies and Tricks
Survive JavaScript - Strategies and Tricks
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad PečanacJavantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.com
 
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
 
Node.js on Azure
Node.js on AzureNode.js on Azure
Node.js on Azure
 
SFO15-500: VIXL
SFO15-500: VIXLSFO15-500: VIXL
SFO15-500: VIXL
 
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
Node.js - Advanced Basics
Node.js - Advanced BasicsNode.js - Advanced Basics
Node.js - Advanced Basics
 

Plus de FITC

Cut it up
Cut it upCut it up
Cut it upFITC
 
Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital HealthFITC
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript PerformanceFITC
 
Surviving Your Tech Stack
Surviving Your Tech StackSurviving Your Tech Stack
Surviving Your Tech StackFITC
 
How to Pitch Your First AR Project
How to Pitch Your First AR ProjectHow to Pitch Your First AR Project
How to Pitch Your First AR ProjectFITC
 
Start by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerStart by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerFITC
 
Cocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryCocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryFITC
 
Everyday Innovation
Everyday InnovationEveryday Innovation
Everyday InnovationFITC
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight WebsitesFITC
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is TerrifyingFITC
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanFITC
 
The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)FITC
 
East of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameEast of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameFITC
 
Creating a Proactive Healthcare System
Creating a Proactive Healthcare SystemCreating a Proactive Healthcare System
Creating a Proactive Healthcare SystemFITC
 
World Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignWorld Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignFITC
 
The Power of Now
The Power of NowThe Power of Now
The Power of NowFITC
 
High Performance PWAs
High Performance PWAsHigh Performance PWAs
High Performance PWAsFITC
 
Rise of the JAMstack
Rise of the JAMstackRise of the JAMstack
Rise of the JAMstackFITC
 
From Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFrom Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFITC
 
Projects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForProjects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForFITC
 

Plus de FITC (20)

Cut it up
Cut it upCut it up
Cut it up
 
Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital Health
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript Performance
 
Surviving Your Tech Stack
Surviving Your Tech StackSurviving Your Tech Stack
Surviving Your Tech Stack
 
How to Pitch Your First AR Project
How to Pitch Your First AR ProjectHow to Pitch Your First AR Project
How to Pitch Your First AR Project
 
Start by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerStart by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the Answer
 
Cocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryCocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s Story
 
Everyday Innovation
Everyday InnovationEveryday Innovation
Everyday Innovation
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight Websites
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is Terrifying
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future Human
 
The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)
 
East of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameEast of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR Game
 
Creating a Proactive Healthcare System
Creating a Proactive Healthcare SystemCreating a Proactive Healthcare System
Creating a Proactive Healthcare System
 
World Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignWorld Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product Design
 
The Power of Now
The Power of NowThe Power of Now
The Power of Now
 
High Performance PWAs
High Performance PWAsHigh Performance PWAs
High Performance PWAs
 
Rise of the JAMstack
Rise of the JAMstackRise of the JAMstack
Rise of the JAMstack
 
From Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFrom Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self Discovery
 
Projects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForProjects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time For
 

Dernier

Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...SUHANI PANDEY
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...SUHANI PANDEY
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls DubaiEscorts Call Girls
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...SUHANI PANDEY
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceDelhi Call girls
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...nilamkumrai
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...SUHANI PANDEY
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubaikojalkojal131
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 

Dernier (20)

Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 

Turbocharging Client-Side Processing: Leveraging asm.js

  • 1. TURBOCHARGING CLIENT-SIDE PROCESSING LEVERAGING ASM.JS Vladimir Vukićević / @vvuk
  • 2. OVERVIEW What is asm.js? Writing asm.js by hand Using Emscripten Integrating libraries What can you do with this
  • 4. vrg=Fot2ra(26) a la3Ary378; fnto mi( { ucin an) vra=0 b=0 a , ; d { o a=8+( < 2 |0 b < ) ; ga> 2 =+[ > 2 +10 [ > ] ga > ] .; b=b+1|0 ; }wie(b|0 <50) hl ( ) 00; } This is asm.js. It's JavaScript, with some rigid rules.
  • 5. asm.js operates on an ArrayBuffer heap asm.js operates only on numeric values asm.js can call regular JavaScript asm.js can be called by regular JavaScript asm.js provides predictable performance
  • 6. TWO WAYS TO USE ASM.JS To bring existing C/C++ apps to the web Many of the current flashy demos do this Great for games Not the focus here To accelerate processing of JS apps Leverage existing libraries Offload and speed up data processing and analysis
  • 7. WRITING ASM.JS BY HAND vrha =nwAryufr49) a ep e raBfe(06; vram=fnto(tlb frin ha){ a s ucinsdi, oeg, ep "s am; ue s" vrHAF2=nwsdi.la3Aryha) a EP3 e tlbFot2ra(ep; fnto aeaeausfrt ls){ ucin vrgVle(is, at frt=frt0 ls =ls|; is is|; at at0 vrcut=0 vrag=00 a on ; a v .; cut=(at-frt > 2 on ls is) > ; wie(frt0 <(at0){ hl (is|) ls|) ag=ag++EP3[is > 2; v v HAF2frt > ] frt=frt+40 is is |; } rtr +ag/+cut0) eun (v (on|); } rtr { eun aeaeaus aeaeaus vrgVle: vrgVle, } ; }wno,{,ha) (idw } ep; / ptsm vle it teha * * u oe aus no h ep / vrHAF2=nwFot2ra(ep; a EP3 e la3Aryha) fr(a i=0 i<2;+i { o vr ; 0 +) HAF2i =i EP3[] ; } / mk tecl * * ae h al / vrag=amaeaeaus0<,2<2; a v s.vrgVle(<2 0<) cnoelgag; osl.o(v)
  • 8. WRITING ASM.JS BY HAND ... DOABLE, BUT PAINFUL. Doable by hand for simple things e.g., a matrix math library It's intended to be a compile target Not just from C/C++! LLJS can target asm.js TypeScript is interested Emscripten for C/C++ source
  • 10. LOTS OF EXISTING CODE OUT THERE For example, open source libraries for... Computer Vision — OpenCV Physics — Box2D, Bullet Compression — zlib, lz4, etc. Text-to-Speech — eSpeak Convex Hull Computation — qhull ...
  • 11. LOTS OF EXISTING CODE OUT THERE Many already have Emscripten ports Some have nice JS layers on top
  • 12. INTEGRATING WITH ASM.JS CODE 1. Get data into asm.js heap vrcnaDt =cxgtmgDt(,0 w h; a avsaa t.eIaeaa0 , , ) / alct saei amj ha * * loae pc n s.s ep / vrhaPr=Mdl.mlo( *h*4; a ept oue_alcw ) vrhaDt =nwUn8ra(EP haPr w*h*4; a epaa e itAryHA, ept, ) / cp cnaDt.aait ha * * oy avsaadt no ep / haDt.e(avsaadt) epaastcnaDt.aa; 2. Call function(s) amouedPoesn(ept,w h; sMdl.orcsighaPr , ) 3. Get data out of heap / cp dt bc t Iaeaa* * oy aa ak o mgDt / cnaDt.aasthaDt) avsaadt.e(epaa; / fe saei amj ha * * re pc n s.s ep / Mdl.fe(ept) oue_rehaPr; / da iaedt bc * * rw mg aa ak / cxptmgDt(avsaa 0 0; t.uIaeaacnaDt, , )
  • 13. INTEGRATING WITH ASM.JS CODE You have to deal with manual memory management and allocation Likely already thinking about it if you're heavily optimizing your JS Make some nice wrappers and avoid having to think about this again
  • 14. NICE WRAPPERS? fnto poesmgDt(mgDt){ ucin rcsIaeaaiaeaa vrw=iaeaawdh h=iaeaahih; a mgDt.it, mgDt.egt vrhaPr=Mdl.mlo( *h*4; a ept oue_alcw ) vrhaDt =nwUn8ra(EP haPr w*h*4; a epaa e itAryHA, ept, ) haDt.e(avsaadt) epaastcnaDt.aa; amouedPoesn(ept,w h; sMdl.orcsighaPr , ) iaeaadt.e(epaa; mgDt.aasthaDt) Mdl.fe(ept) oue_rehaPr; }
  • 15. JUST ANOTHER MODULE JavaScript App App Code EmberJS jQuery ... asm.js code
  • 16. SOME ODDS AND ENDS Use Worker Threads Use async Script Loading
  • 17. USING WORKER THREADS Place your asm.js module on a worker Asynchronous execution, no jank! Main App code postMessage ⇒ request ⇐ postMessage reply Worker asm.js module
  • 18. (ASIDE) WORKERS ARE AWESOME And will get even more awesome We've got lots of APIs coming to workers, including... WebRTC WebGL & Canvas 2D Web Sockets Web Audio Synchronous message passing
  • 19. USING ASYNCHRONOUS SCRIPT LOADING asm.js code can be large, and parsing and compiling takes time. <citaycsc"i/ysLbj"<srp> srp sn r=lbmAmi.s>/cit Add async. Magic. In the (very near) future, such compilation will also be cached.
  • 20. WHAT DO I DO WITH THIS? Processing/resizing of photos client-side (color correction, face identification) Data analysis (download raw data to client)
  • 21. WHAT DO I DO WITH THIS? Face login/confirmation (WebRTC + UserMedia + canvas) Add text-to-speech (read notices in the background)
  • 22. WHAT DO I DO WITH THIS? Implement new image (and video?) codecs (specialized or experimental) Recognize barcodes (handy on mobile!)
  • 23. PERFORMANCE? "Within 2x of native." ... pretty consistently. Even on mobile! Take advantage to make mobile apps feel more like native.
  • 24. IT'S DANGEROUS TO GO ALONE You'll need... Some familiarity with C/C++ (or someone nearby familiar with C/C++) Emscripten and Emscripten SDK
  • 25. NOT JUST FOR C/C++ Focus has been on C/C++ due to large body of existing code Lua, Python, etc. all exist For example, give users ability to write scripts in Lua