[HN Gopher] WebAssembly without the browser part 1
       ___________________________________________________________________
        
       WebAssembly without the browser part 1
        
       Author : pacificat0r
       Score  : 39 points
       Date   : 2020-08-16 19:08 UTC (3 hours ago)
        
 (HTM) web link (alexene.dev)
 (TXT) w3m dump (alexene.dev)
        
       | MPSimmons wrote:
       | Things like this is how we got NodeJS. Sigh.
        
         | Kye wrote:
         | I don't see how this is a problem. A lot of good came with the
         | bad. This is like when people complain about Visual Basic or
         | PHP. They were awful in so many ways, but they got a lot of
         | people into programming, and those people did a lot of cool
         | things.
        
         | thosakwe wrote:
         | How is the existence of NodeJS a bad thing?
        
       | tess0r wrote:
       | Author of wasmex[1] here (an elixir package which allows runnung
       | WASM).
       | 
       | Next to the mentioned wasmtime, wasm3, and wamr, there is also
       | wasmer[2] I would add to the list of capable WASM runtimes.
       | 
       | The great things these runtimes offer are how easy they are to
       | integrate into other programming languages environments. E.g.
       | with wasmex you could easily run WASM from your elixir
       | application (or with wasmer from ruby[3] or many other languages
       | if you want).
       | 
       | Imagine building shopify, but without needing to invent your own
       | template language for customers to extend their shop-template[4].
       | They could provide a WASM extension API where shop-owners could
       | let sandboxed WASM files render their shop. This would let allow
       | shop-owners to write templates in their favorite language instead
       | of e.g. liquid and still be secure.
       | 
       | [1] https://github.com/tessi/wasmex/ [2]
       | https://github.com/wasmerio/wasmer [3]
       | https://rubygems.org/gems/wasmer [4]
       | https://github.com/Shopify/liquid
        
       | azakai wrote:
       | > WebAssembly enables predictable and stable performance because
       | it doesn't require garbage collection like the usual options
       | (LUA/JavaScript).
       | 
       | GC is a small part of that - the much bigger factor is dynamic
       | optimization is necessary for fast Lua or JavaScript. Wasm is
       | designed to not need that (like most languages that are not
       | dynamically typed).
        
         | wffurr wrote:
         | Some wasm runtimes, eg V8 and Spider monkey, do tiered
         | compilation, where all code is first compiled with a high
         | throughput streaming compiler, and then only the hot paths get
         | recompiled with an optimizing compiler.
        
           | azakai wrote:
           | True, good point!
           | 
           | Tiered compilation in general does dynamic optimizations,
           | definitely in JavaScript (runtime type collection, etc.) but
           | also to a lesser extent in C# or Java (inlining, etc.). In
           | wasm none of the tiers do dynamic optimizations AFAIK, but
           | tiered compilation definitely helps there too, mostly with
           | startup times.
        
       | hardwaregeek wrote:
       | One area that I'm hoping WebAssembly will help with is running
       | native extensions in a portable sandbox. That way libraries like
       | nokogiri can be compiled to wasm ahead of time, then executed on
       | a wasm runtime. There will be a perf hit but not having to wait
       | for nokogiri to compile native extensions will be worth it.
        
         | jnwatson wrote:
         | I think the ability to run unknown code in a sandbox is
         | probably the most interesting use case. This is particularly
         | compelling in P2P computing projects.
        
           | enos_feedler wrote:
           | I am really hoping the mobile platforms like iOS offer pure
           | wasm sandbox APIs for this use case. This could be a powerful
           | way to support programmability, app extensions, etc outside
           | of the appstore. It could appease both Apple for security and
           | developers for flexibility.
        
           | abhiyerra wrote:
           | I built a toy application to do exactly this using IPFS.
           | https://github.com/abhiyerra/ipswarm
        
       | Shared404 wrote:
       | This seems to me like WebAssembly works basically like Java, but
       | the bytecode can be compiled to from multiple languages.
       | 
       | Is this correct?
        
         | Skinney wrote:
         | It's like Java bytecode in the sense that it's a bytecode spec
         | for a virtual machine, but otherwise quite different. Wasm
         | doesn't include a GC or support for OO out of the box. It
         | doesn't even have strings.
         | 
         | That's great for compiling languages like C++ or Rust though,
         | but makes compiling higher order langues like python or java to
         | it.
        
       | chrisweekly wrote:
       | I found this writeup to be fairly well-written and detailed, but
       | I lack the WebAssembly knowledge to comment on its other merits.
        
       ___________________________________________________________________
       (page generated 2020-08-16 23:00 UTC)