SlideShare a Scribd company logo
Do things faster & better
with WebAssembly
@sendilkumarn
Sendil Kumar
• Full stack developer @Xebialabs
• Core dev team member @JHipster
• Team member @webpack
• Part of rust-wasm Working Group
• Big open source lover & enthusiast
Do things faster and better with WebAssembly - Sendil Kumar Nellaiyapen - Codemotion Rome 2018
@sendilkumarn
You can reach me at
C / C++ devs ?
Rust devs ?
What does Rust / C++
offer?
Faster
More
control
SafetyTypes
Closer to
machine
JS devs ?
Fullstack JS devs ?
What does JS offer?
Try to be
faster
Easier to
read
Easier to
writeTypes?
Far from
machine
What you do to increase
the Performance of your
App ?
Minify
Async & Defer
Reduce dom
manipulation
Profile
JS Engine based
optimisations
Immutability
Type system
Code splitting
Service worker
Let us do a
performance question
Which has higher
performance?
function test() {
let arr = [];
arr[0] = 1;
arr[1] = 2;
arr[2] = 3;
}
function test() {
let arr = [];
arr[0] = 1;
arr[2] = 3;
arr[1] = 2;
}
Which has higher
performance?
function test() {
let arr = [];
arr[0] = 1;
arr[1] = 2;
arr[2] = 3;
}
function test() {
let arr = [];
arr[0] = 1;
arr[2] = 3;
arr[1] = 2;
}
Which has higher
performance?
let arr = new Array(3);let arr = [];
Which has higher
performance?
let arr = []; let arr = new Array(3);
But why 😱?
Packed & Holey Array
https://v8project.blogspot.nl/2017/09/elements-kinds-in-v8.html
Do things faster and better with WebAssembly - Sendil Kumar Nellaiyapen - Codemotion Rome 2018
Uncertainties😕🤔
Most of the profiling, needs you to know
more about the internals of JS engine.
Optional
Arguments
Packed/Holey
Array
Monomorphisation
Micro-
benchmarking
Engine based
tunings
Known engine
shortcomings
Time-
consuming
Uncertainty in
performance & results
⚙ Maintainability ⚙
How better will it be to have
the consistency & speed of
native code in browsers?
WebAssembly
Binary encoded - Stack machine
In other words, you can compile
your native code and make
them run in your browser.
Do things faster and better with WebAssembly - Sendil Kumar Nellaiyapen - Codemotion Rome 2018
🚀 Fast & Efficient
🚀 Fast & Efficient
🔐 Safe
🚀 Fast & Efficient
🔐 Safe
🧐 Debuggable
🚀 Fast & Efficient
🔐 Safe
🧐 Debuggable
🕸 Open web platform
“WebAssembly is not a
replacement of JAVASCRIPT”
integrating well and being symbiotic
How JS works now inside
JS Engine
PARSE
COMPILE
OPTIMIZE
Re-OPTIMIZE
EXECUTE
GC
Javascript AST
PARSE
COMPILE
OPTIMIZE
Re-OPTIMIZE
EXECUTE
GC
Profiler
🔥
COMPILE 0101010101010
PARSE
COMPILE
OPTIMIZE
Re-OPTIMIZE
EXECUTE
GC
Profiler
🔥🔥🔥🔥🔥
PARSE
COMPILE
OPTIMIZE
Re-OPTIMIZE
EXECUTE
GC
Profiler
PARSE
COMPILE
OPTIMIZE
Re-OPTIMIZE
EXECUTE
GC
Profiler
🚮
How WASM Works?
DECODE
COMPILE
EXECUTE
01010101001010 0101011001111000
DECODE
COMPILE
EXECUTE
0101
0110
0111
1000
0101011001111000
DECODE
COMPILE
EXECUTE
0111
1000
0110 5
Simple Example in
Rust
#[no_mangle]
pub extern fn add_one(x: i32) -> i32{
x+1
}
RUST
rustc +nightly 
— —target wasm32-unknown-unknown 
-O test.rs
WASM
Raw binary format
WASM
MODULE
IMPORT
TABLE MEMORY
GLOBAL
EXPORT
ELEMENT
DATA
START
FUNCTION &
CODE
Let us see what is inside
Module
WASM
IMPORT
EXPORT
FUNCTION &
CODE
(import …)
(export …)
(func …)
Anything that you want to import inside WASM
Anything that you want to export outside WASM
Actual Binary code to execute
WASM
MEMORY
GLOBAL
START (start $start_function)
first function to get loaded & run in the module
(global type mutability expr)
(memory init-size max-size(opt))
WASM
TABLE
ELEMENT
DATA Data -> linear array of memory indexes
GC references, raw OS handles, or native pointers
Allows module to initialise the elements
(module
(type $t0
(func (param i32) (result i32)))
(func $add_one (export “add_one”)
(type $0) (param $p0 i32) (result i32)
get_local $p0
i32.const 1
i32.add
)
(table $T0 0 anyfunc)
(memory $memory (export “memory”) 17)
(data (i32.const 4) “10001000”))
WAST
(module )
Module
(type $t0
(func
(param i32)
(result i32)
)
)
Type
(func $add_one
(export “add_one”)
(type $0)
(param $p0 i32)
(result i32)
get_local $p0
i32.const 1
i32.add
)
Actual function
(table $T0 0 anyfunc)
Table
(memory $memory
(export “memory”)
17)
Memory
(data
(i32.const 4)
“10001000”)
)
Data
How to load them?
Using fetch…
Using compile streaming…
Using instantiate streaming…
⚠Few browsers yet to support
Streaming compilation
speeds up the wasm
performance by 10-15 times
Streaming compilation will be coming to JS… 🎉 🎉 🎉 🎉 🎉 🎉
ESM spec for WASM
⚠Still in very early stages, and will be implemented
Demo Time ⏱
Future 🎠
🦄 Garbage Collection
🦄 DOM Manipulation
🦄 Bulk memory operations
🦄 Threads
🦄 Exception handling
Questions?
Happy Hacking 😎

More Related Content

PDF
Modern infrastructure as code with ansible cake fest 2021
PPTX
Save time, save money: Move your selenium testing on cloud
PPTX
Put kajakken på hylden - og få sexede windows services
PPTX
LONDON SDET MEETUP - Difference between Selenium and Cypress presentation
PPTX
Cypress Automation
PPTX
Selenium with protractor
PPT
Continuous Integration
PDF
Cypress testing
Modern infrastructure as code with ansible cake fest 2021
Save time, save money: Move your selenium testing on cloud
Put kajakken på hylden - og få sexede windows services
LONDON SDET MEETUP - Difference between Selenium and Cypress presentation
Cypress Automation
Selenium with protractor
Continuous Integration
Cypress testing

What's hot (20)

PPTX
WP-CLI: WordCamp Nashville 2016
PDF
Cypress e2e automation testing - day1 intor by: Hassan Hameed
PDF
Building software by feature with immutable infrastructures on AWS
PPTX
The WordPress REST API as a Springboard for Website Greatness
PPTX
Why I am hooked on the future of React
PDF
Getting Started With Cypress
PPTX
Why you should switch to Cypress for modern web testing?
PDF
Google App Engine: For PHP Developers
PPTX
Fullstack workshop
PDF
Getting Started with PHP on Engine Yard Cloud
PPTX
Applying BDD in refactoring
PPTX
Rare frontend testing
PPTX
Selenoid & Allure - how to make them work together?
PPTX
PowerShell: Automation for everyone
PDF
Aws, play! couch db scaling soa in the cloud
PPSX
Server Side Rendering, caching and performance
PPTX
Speed up your regression and reduce cost load with Selenoid + K8s + ReportPortal
PPTX
Silverlight vs HTML5 - Lessons learned from the real world...
PPTX
Cypress report
PDF
DevOps: Building by feature with immutable infrastructure at Serv.sg
WP-CLI: WordCamp Nashville 2016
Cypress e2e automation testing - day1 intor by: Hassan Hameed
Building software by feature with immutable infrastructures on AWS
The WordPress REST API as a Springboard for Website Greatness
Why I am hooked on the future of React
Getting Started With Cypress
Why you should switch to Cypress for modern web testing?
Google App Engine: For PHP Developers
Fullstack workshop
Getting Started with PHP on Engine Yard Cloud
Applying BDD in refactoring
Rare frontend testing
Selenoid & Allure - how to make them work together?
PowerShell: Automation for everyone
Aws, play! couch db scaling soa in the cloud
Server Side Rendering, caching and performance
Speed up your regression and reduce cost load with Selenoid + K8s + ReportPortal
Silverlight vs HTML5 - Lessons learned from the real world...
Cypress report
DevOps: Building by feature with immutable infrastructure at Serv.sg
Ad

Similar to Do things faster and better with WebAssembly - Sendil Kumar Nellaiyapen - Codemotion Rome 2018 (20)

PDF
Serverless in production, an experience report (LNUG)
PDF
Bringing the JAMstack to the Enterprise
PDF
Serverless in production, an experience report (CoDe-Conf)
PPT
Windy cityrails performance_tuning
PPT
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
PPT
Scripting Oracle Develop 2007
PDF
Continous UI testing with Espresso and Jenkins
PDF
Serverless in Production, an experience report (cloudXchange)
PDF
Performance as User Experience [An Event Apart Denver 2017]
PDF
Performance as User Experience [AEA SEA 2018]
PDF
DevOps For Small Teams
PPT
The Web on OSGi: Here's How
PDF
Serverless in production, an experience report (FullStack 2018)
PDF
Serverless in production, an experience report (JeffConf)
PPTX
Glimpse of Loops Vs Set
PDF
AWS Lambda from the trenches
ODP
Integration Testing in Python
PPT
Continuous deployment
PDF
Serverless in Production, an experience report (AWS UG South Wales)
PDF
The future of paas is serverless
Serverless in production, an experience report (LNUG)
Bringing the JAMstack to the Enterprise
Serverless in production, an experience report (CoDe-Conf)
Windy cityrails performance_tuning
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Scripting Oracle Develop 2007
Continous UI testing with Espresso and Jenkins
Serverless in Production, an experience report (cloudXchange)
Performance as User Experience [An Event Apart Denver 2017]
Performance as User Experience [AEA SEA 2018]
DevOps For Small Teams
The Web on OSGi: Here's How
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (JeffConf)
Glimpse of Loops Vs Set
AWS Lambda from the trenches
Integration Testing in Python
Continuous deployment
Serverless in Production, an experience report (AWS UG South Wales)
The future of paas is serverless
Ad

More from Codemotion (20)

PDF
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
PDF
Pompili - From hero to_zero: The FatalNoise neverending story
PPTX
Pastore - Commodore 65 - La storia
PPTX
Pennisi - Essere Richard Altwasser
PPTX
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
PPTX
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
PPTX
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
PPTX
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
PDF
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
PDF
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
PDF
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
PDF
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
PDF
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
PDF
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
PPTX
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
PPTX
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
PDF
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
PDF
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
PDF
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
PDF
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Pompili - From hero to_zero: The FatalNoise neverending story
Pastore - Commodore 65 - La storia
Pennisi - Essere Richard Altwasser
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019

Recently uploaded (20)

PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
KodekX | Application Modernization Development
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Cloud computing and distributed systems.
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Spectroscopy.pptx food analysis technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Review of recent advances in non-invasive hemoglobin estimation
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Diabetes mellitus diagnosis method based random forest with bat algorithm
KodekX | Application Modernization Development
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Big Data Technologies - Introduction.pptx
Cloud computing and distributed systems.
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
sap open course for s4hana steps from ECC to s4
Spectroscopy.pptx food analysis technology
NewMind AI Weekly Chronicles - August'25 Week I
Reach Out and Touch Someone: Haptics and Empathic Computing
Unlocking AI with Model Context Protocol (MCP)
The Rise and Fall of 3GPP – Time for a Sabbatical?
MIND Revenue Release Quarter 2 2025 Press Release
Machine learning based COVID-19 study performance prediction

Do things faster and better with WebAssembly - Sendil Kumar Nellaiyapen - Codemotion Rome 2018