First Step Towards
WebAssembly with Rust
Presented By: Pankaj Chaudhary
Software Consultant
Knoldus Inc.
LEARN NOW
About Knoldus
Knoldus is a technology consulting firm with focus on modernizing the digital systems
at the pace your business demands.
DevOps
Functional. Reactive. Cloud Native
Quick introduction to Rust
WebAssembly
WebAssembly Architecture
Hands on example
How and where you should use WASM
Our Agenda
01
02
03
04
05
Rust programming language
Rust is a multi-paradigm system programming language that can
provide better memory safety while maintaining high performance. It
runs blazingly fast, prevents almost all crashes, and eliminates data
races. It has an exceptional feature of memory management which can
be achieved by the Ownership Concept.
Features of Rust
❖ Fix common memory safety problems.
➢ Memory safety.
■ Ownership and Borrowing
➢ Rust safety.
■ Single Mutable multiple immutable
■ No NULL only OPTION.
❖ Performance.
❖ Portability.
❖ Stability.
Microsoft Vulnerability survey
Large Projects Using Rust as development
❖ Amazon Firecracker.
❖ Windows Runtime.
❖ One Signal.
❖ NPM.
❖ Azure IOT.
❖ Discord.
❖ Oxidation.
❖ Firefox Quantum.
❖ CloudFlare.
WebAssembly
Web Development Today
● Browser
Compatibility
● Disparate build
environment
● TypeScript,
JavaScript,
CoffeeScript,
X-to-JS
CodeGen.
As SPA’s gets better
and more powerful, gets
everything gets slower.
● Slow builds.
● Bloated
Frameworks.
● Code Performance.
● Browser Issues.
● An infinite number
of ways to solve
every problem.
● Too many libraries,
too much to learn
node_module
directory is a meme.
● Rapid ecosystem
change.
Fragmented Slow Overwhelming
WebAssembly
❏ Portable and Standardized binary format of stack machine instructions..
❏ Safe and Isolated execution and memory.
❏ Supported by all modern web browsers.
❏ Compile to WASM from any supported language
❏ C, C++
❏ Go
❏ Rust
❏ Interpret in Many languages:
❏ JavaScript
❏ Go
❏ Rust
❏ Node
❏ C, C++
Efficient and Fast
WebAssembly aims to execute at
native speed by taking advantage
of common hardware capabilities
available on a wide range of
platforms.
01
Open and debuggable
WebAssembly is designed to be
pretty-printed in a textual format for
debugging, testing, experimenting,
optimizing, learning, teaching, and
writing programs by hand.
03
Safe
WebAssembly describes a
memory-safe, sandboxed execution
environment that may even be
implemented inside existing
JavaScript virtual machines.
02
Open web platform
WebAssembly is designed to
maintain the versionless,
feature-tested, and
backwards-compatible nature of
the web.
04
WebAssembly features
WebAssembly Architecture
WebAssembly Architecture
WebAssembly Methods
❖ WebAssembly.compile()
❖ WebAssembly.compileStreaming()
❖ WebAssembly.instantiate()
❖ WebAssembly.instantiateStreaming()
❖ WebAssembly.validate()
Hands-On to WebAssembly
❏ Quick start with WebAssembly Studio.
❏ Some more examples.
How WebAssembly Will Change the Way To Develop Web Applications?
❏ Compatible with All Major Operating Systems and Web Browsers.
❏ Offers Programming Language Choice to Developers.
❏ Provides Better Load Time to Web Applications.
❏ Ensures Secure Experience to Users.
Where You Should Use WebAssembly?
❏ Heavy applications.
❏ High Performance.
❏ Near Native speed.
References
❏ https://webassembly.org/
❏ https://rustwasm.github.io/book/
❏ https://developer.mozilla.org/en-US/docs/WebAssembly
❏ https://github.com/WebAssembly
❏ https://datafloq.com/read/competitor-siblings-webassembly-replace-javascript/6821
❏ https://www.youtube.com/watch?v=YDQICTKlr9g
Go to Website
Thank You!
@pankaj.chaudhary@knoldus.com
@chaudhary-pankaj
@itsPChaudhary

First Step towards WebAssembly with Rust

  • 1.
    First Step Towards WebAssemblywith Rust Presented By: Pankaj Chaudhary Software Consultant Knoldus Inc. LEARN NOW
  • 2.
    About Knoldus Knoldus isa technology consulting firm with focus on modernizing the digital systems at the pace your business demands. DevOps Functional. Reactive. Cloud Native
  • 3.
    Quick introduction toRust WebAssembly WebAssembly Architecture Hands on example How and where you should use WASM Our Agenda 01 02 03 04 05
  • 4.
    Rust programming language Rustis a multi-paradigm system programming language that can provide better memory safety while maintaining high performance. It runs blazingly fast, prevents almost all crashes, and eliminates data races. It has an exceptional feature of memory management which can be achieved by the Ownership Concept.
  • 5.
    Features of Rust ❖Fix common memory safety problems. ➢ Memory safety. ■ Ownership and Borrowing ➢ Rust safety. ■ Single Mutable multiple immutable ■ No NULL only OPTION. ❖ Performance. ❖ Portability. ❖ Stability.
  • 6.
  • 7.
    Large Projects UsingRust as development ❖ Amazon Firecracker. ❖ Windows Runtime. ❖ One Signal. ❖ NPM. ❖ Azure IOT. ❖ Discord. ❖ Oxidation. ❖ Firefox Quantum. ❖ CloudFlare.
  • 8.
  • 9.
    Web Development Today ●Browser Compatibility ● Disparate build environment ● TypeScript, JavaScript, CoffeeScript, X-to-JS CodeGen. As SPA’s gets better and more powerful, gets everything gets slower. ● Slow builds. ● Bloated Frameworks. ● Code Performance. ● Browser Issues. ● An infinite number of ways to solve every problem. ● Too many libraries, too much to learn node_module directory is a meme. ● Rapid ecosystem change. Fragmented Slow Overwhelming
  • 10.
    WebAssembly ❏ Portable andStandardized binary format of stack machine instructions.. ❏ Safe and Isolated execution and memory. ❏ Supported by all modern web browsers. ❏ Compile to WASM from any supported language ❏ C, C++ ❏ Go ❏ Rust ❏ Interpret in Many languages: ❏ JavaScript ❏ Go ❏ Rust ❏ Node ❏ C, C++
  • 11.
    Efficient and Fast WebAssemblyaims to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms. 01 Open and debuggable WebAssembly is designed to be pretty-printed in a textual format for debugging, testing, experimenting, optimizing, learning, teaching, and writing programs by hand. 03 Safe WebAssembly describes a memory-safe, sandboxed execution environment that may even be implemented inside existing JavaScript virtual machines. 02 Open web platform WebAssembly is designed to maintain the versionless, feature-tested, and backwards-compatible nature of the web. 04 WebAssembly features
  • 12.
  • 13.
  • 14.
    WebAssembly Methods ❖ WebAssembly.compile() ❖WebAssembly.compileStreaming() ❖ WebAssembly.instantiate() ❖ WebAssembly.instantiateStreaming() ❖ WebAssembly.validate()
  • 15.
    Hands-On to WebAssembly ❏Quick start with WebAssembly Studio. ❏ Some more examples.
  • 16.
    How WebAssembly WillChange the Way To Develop Web Applications? ❏ Compatible with All Major Operating Systems and Web Browsers. ❏ Offers Programming Language Choice to Developers. ❏ Provides Better Load Time to Web Applications. ❏ Ensures Secure Experience to Users.
  • 17.
    Where You ShouldUse WebAssembly? ❏ Heavy applications. ❏ High Performance. ❏ Near Native speed.
  • 19.
    References ❏ https://webassembly.org/ ❏ https://rustwasm.github.io/book/ ❏https://developer.mozilla.org/en-US/docs/WebAssembly ❏ https://github.com/WebAssembly ❏ https://datafloq.com/read/competitor-siblings-webassembly-replace-javascript/6821 ❏ https://www.youtube.com/watch?v=YDQICTKlr9g
  • 21.
  • 22.