Upgrade to Pro — share decks privately, control downloads, hide ads and more …

dotJS 2019 - Into WebAssembly

vladikoff
December 05, 2019

dotJS 2019 - Into WebAssembly

vladikoff

December 05, 2019
Tweet

More Decks by vladikoff

Other Decks in Programming

Transcript

  1. @vladikoff | Paris 2019 Vlad Filippov Toronto, Canada 󰎟 vf.io

    twitter.com/vladiko ff github.com/vladikoff
  2. @vladikoff | Paris 2019 You probably already heard about WebAssembly...

    • A new low-level bytecode format for the Web • Stack-based virtual machine, produces *.wasm modules • User for: ◦ Calculations and computational tasks ◦ Importing low-level components from other languages ◦ Audio, Image and Video processing ◦ Game development ◦ Bitcoin mining $$$$ • Integrates well with the Web Developer workflow https://www.tu-braunschweig.de/Medien-DB/ias/pubs/2019-dimva.pdf
  3. @vladikoff | Paris 2019 xxHash - an extremely fast non-cryptographic

    hash algorithm. Implementation in different languages. INPUT: “String” OUTPUT: 38F1791AF7DCE8B5 COMPUTE: XXH.h64(INPUT) 100 000 times
  4. @vladikoff | Paris 2019 Compute... Web Worker Main Thread createWasmWebWorker('parser.wasm').then(parser

    => { const result = parser.input(data); }); Done! Use web workers with WebAssembly... new Worker('worker.js');
  5. @vladikoff | Paris 2019 bytecodealliance.org WASM beyond the browser... •

    Using WebAssembly System Interfaces (WASI) to go run WASM beyond the browser. • New software security model, useful for C++ and Rust, etc. • WebAssembly speed to runtimes in Python, node.js, etc. open source community dedicated to creating secure new software foundations through WebAssembly Python node.js .NET
  6. @vladikoff | Paris 2019 “nanoprocess” security model goal Python node.js

    process sandboxed: memory network access sandboxed: memory file system access sandboxed: memory
  7. @vladikoff | Paris 2019 In conclusion... • Use WebAssembly wisely

    - benchmark, optimize inputs, workers! • WebAssembly might not always be a solution! • Keep an eye on WASM module size and your WebPack output • Research different WASM runtimes • Go beyond the Web Browser and get excited for the future with WebAssembly!