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

Do things faster and better with webassembly

Do things faster and better with webassembly

Sendil Kumar N

March 29, 2018
Tweet

More Decks by Sendil Kumar N

Other Decks in Technology

Transcript

  1. 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
  2. Minify Async & Defer Reduce dom manipulation Profile JS Engine

    based optimisations Immutability Type system Code splitting Service worker
  3. Which has higher performance? function test() { let arr =

    []; arr.push(1); arr.push(2); arr.push(3); } function test() { let arr = new Array(3); arr.push(1); arr.push(2); arr.push(3); }
  4. This has higher performance function test() { let arr =

    []; arr.push(1); arr.push(2); arr.push(3); } function test() { let arr = new Array(3); arr.push(1); arr.push(2); arr.push(3); }
  5. How better will it be to have the consistency &

    speed of native code in browsers?
  6. WASM MEMORY GLOBAL START (start $start_function) The first function to

    be loaded in the module (global type mutability expr) (memory init-size max-size(opt))
  7. WASM TABLE ELEMENT DATA Data -> linear array of memory

    indexes GC references, raw OS handles, or native pointers Allows module to initialise the elements
  8. (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) “\10\00\10\00”)) WAST
  9. (func $add_one (export “add_one”) (type $0) (param $p0 i32) (result

    i32) get_local $p0 i32.const 1 i32.add ) Actual function
  10. Streaming compilation speeds up the wasm performance by 10-15 times

    Streaming compilation will be coming to JS…