Results 1 to 3 of 3

Thread: WebAssembly (Wasm)

  1. #1
    Member SolidComp's Avatar
    Join Date
    Jun 2015
    Location
    USA
    Posts
    347
    Thanks
    129
    Thanked 53 Times in 37 Posts

    WebAssembly (Wasm)

    Hi all — Have any of you experimented with WebAssembly (Wasm)? It's an interesting high-performance binary compilation target for web browsers, with better than JS performance. I think there are compilers for C, C++, Rust, Typescript, Go, and a few other languages, though I'm not sure about their maturity. The C/C++ compiler seems most mature.

    Wasm applications run in a virtual stack machine, with static types. It's not meant to be programmed in directly, but rather is a compilation target for other PLs. Wasm's text representation looks like s-expressions.

    Are there any compression benchmarks that include Wasm implementations? I haven't seen anything so far.

    It looks like a good way for web apps and games to use compression codecs other than gzip and brotli – codecs that aren't built into browsers yet, like Zstd, Kraken, etc. Wasm is supported by all major browsers: Edge, Chrome, Firefox, Safari, and Opera.

    Homepage: https://webassembly.org/

    MDN: https://developer.mozilla.org/en-US/docs/WebAssembly

  2. #2
    Member
    Join Date
    Sep 2008
    Location
    France
    Posts
    885
    Thanks
    480
    Thanked 278 Times in 118 Posts
    I've tested wasm compilation target some time ago with both lz4 and zstd.

    I found the performance to be surprisingly good.
    In "good" cases, it was only ~10% slower than native 32-bit code.
    In "worse" cases, it was up to 2x slower.
    Most of the times, outcome will be between those 2 extremes, which I believe is still very good.

    On the minus side, vector instructions did not work (documentation hints that it should or will be present, but I was not so lucky in my tests).
    Also, as the address space is 32-bit, it can force some code to use a 32-bit code path.
    The impact is especially sensible for `zstd`, since its 64-bit variant is substantially faster.

    Anyway, not magical, but definitely functional, and already good enough in the performance department.
    I agree it opens new possibilities.

    As a follow-up example, `zstd` repository now hosts a script from Carl Woffenden
    which converts the `libzstd` library into a single source file, then compile and test it in `wasm` mode :
    https://github.com/facebook/zstd/tre..._libs/examples

  3. Thanks:

    Shelwien (13th April 2020)

  4. #3
    Member
    Join Date
    May 2018
    Location
    Turkey
    Posts
    2
    Thanks
    58
    Thanked 2 Times in 1 Post
    Below is an interesting video filter test. (WASM vs JS)

    https://d2jta7o2zej4pf.cloudfront.net/

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •