Wasmer 5.0

(wasmer.io)

169 points | by syrusakbary 7 hours ago ago

42 comments

  • skybrian 25 minutes ago

    These performance graphs are confusing and possibly cursed. Sometimes they're log scale (confusing enough) and others, I have no idea what they're trying to say.

    For example, the first graph, labelled "Argon 2", nearly all the bars are the same length, labelled "100" (no units given, apparently log scale) and the individual bars are labelled with entirely different numbers in ms (presumably milliseconds).

  • ledgerdev 6 hours ago

    > having V8 as a backend also means supporting WebAssembly Exceptions and Garbage Collection under the hood. Stay tuned for more news on this front soon

    Looking forward to this and languages that can make use of wasm-gc.

    Does wasm-gc allow sharing of host data/strings across different modules in the same runtime, or is it contained to only single module with repeated calls/invocations? The scenario I am considering would invoke several different modules in a pipeline, pass data between each step in an efficient manner.

    • throw4950sh06 6 hours ago

      That's what reference types (the Wasm proposal) are for, GC builds on top of that.

    • azakai 3 hours ago

      Sharing GC data between wasm modules is supported, yes. You just need to define the types identically on both sides, and things work.

  • OtomotO 5 hours ago

    Interesting.

    I am happy with wasmtime though.

    Hacking on a wasm component model and wasi based plugin system these days.

    Having loads of fun. (I am aware of extism, but I am doing it for the fun :))

    • bschwindHN 4 hours ago

      > Hacking on a wasm component model and wasi based plugin system these days.

      Same here! Can you share what you're working on? I'm (slowly) making a 3D CAD modeling API, so you write Rust code to define a model, and compile it to WASM so it can hot-reload and let you iterate faster.

      https://github.com/bschwind/opencascade-rs/tree/main/crates/...

      • 1oooqooq an hour ago

        shape.faces().farthest(Direction::PosZ)

        nice. is this original from openscad (if that even is your inspiration)?

  • DustinBrett 5 hours ago

    I wish they had a solution that didn't require Cross-Origin Isolated headers. I am still using an older version where that wasn't required.

    • nextaccountic 40 minutes ago

      What do you mean? Wasmer isn't a web frontend tech

  • enugu 3 hours ago

    Could this ever function as a less resource intensive substitute for Electron apps? WASM doesn't have DOM access, but could it be added in these extensions?

    Edit: Maybe this question doesn't make sense as the OS would need to have the runtime installed, and if that can be assumed, we would have lightweight apps already.

  • punkpeye 5 hours ago

    Would this allow to safely eval Node.js code in a sandbox?

    • samtheprogram an hour ago

      Not "Node.js code" specifically as Node.js itself can't be compiled to wasm. JavaScript can be compiled to wasm, but that won't include the whole Node.js standard library and doesn't seem to be what you are asking.

      Check out Deno for a sandbox that is getting there. Their new release does (aim to) support most Node.js code, where it previously and intentionally did not support node_modules nor CommonJS to the best of my knowledge.

      If you care more about wasm than sandboxing in general, one project called javy is interesting, but you'll quickly notice they bring their own IO library and not much else in terms of something that compares to Node.js' API.

  • MuffinFlavored 6 hours ago

    Cool release!

    I've yet to personally find a good use case for wasm in any project, kind of the same way I'm not quite sure what to do with a bunch of Raspberry Pis

    It fills a need, I just don't know who/what has that need.

    Example: Say I write a bunch of Rust async projects for fun. Scraping APIs, etc.

    How/why would I choose wasm/wasmer to do that instead? I'd do it in Rust (awkwardly/in some specific non-standard way) to compile to wasm to then run in wasmer? To what benefit? Ok, that's not a good usecase/example

    So what is?...

    • LSRegression 5 hours ago

      A toy project, but I'm working on a Scrabble clone for my mother to play. There's singleplayer against an AI, and then multiplayer against other people (myself, mostly). Multiplayer needs a server backend with all the game logic which I have programmed in Rust, but there's no reason I can't have the game logic for singleplayer running entirely in the browser.

      By compiling my backend code to WASM I basically do that - the client can use either a client-side 'server' or connect to a real server. The UI code itself is unchanged in either case.

      I suppose the need in this case is that I have code written in a language other than JS and I want to run it in a browser; inversely I could have written the entire project in JS and hosted my backend server on say Node.

      • globalnode an hour ago

        > Multiplayer needs a server backend

        Did you mean single player? Although perhaps I'm just old and thinking about this in a strange way.

        And can I clarify.. your scrabble app is web based already right? connecting to a rust web server for the game logic? And you want to embed that server by compiling to wasm? I probably should go read up on how this works.

    • 01HNNWZ0MV43FF 6 hours ago

      It probably makes sense if you're running untrusted code or handling untrusted data, or running code that was written after the rest of your app

      So for a solo dev it doesn't add much, but for a web browser or something that needs plugins it could make a lot of sense.

      • 1oooqooq an hour ago

        history tells us, that usecase will go out the window as soon as the usual suspects do their usual standards capture by implementation to support something or another related to advertising attribution.

      • MuffinFlavored 6 hours ago

        > It probably makes sense if you're running untrusted code or handling untrusted data

        I never understood this because... I feel like wasm (the standard) is an empty box and a lot of runtimes help you attach things to it / make it useful (able to read/write to filesystem, call the Internet, etc.)

    • Starlevel004 6 hours ago

      WASM has two primary usages:

      1) Making canvas webapps with unblockable ads built-in

      2) Downloading and running random blobs of other people's code in a sandbox

      • taberiand 6 hours ago

        To be fair, a rock-solid sandbox with extremely well defined and host controlled ingress/egress in a tiny package sounds absolutely fantastic

        • 1oooqooq an hour ago

          that would have been implement in something like forward only language like ebpf. wasm is just an outgrown hack that people are hopping will be that safe sandbox and solve all JavaScript problems.

          do not fool yourself with this temporary feature. wasm was first for js performance. secondly for portability. and third and accidentally for sandbox.

        • api 6 hours ago

          That’s what it is.

      • peutetre 3 hours ago

        You can do both of those things in JavaScript.

        WebAssembly brings every language to the web and does it with higher performance than JavaScript.

        • enugu 38 minutes ago

          For sandboxing in JS, we can use a sandboxed iframes or webworkers. Both of those communicate to hosted code via postmessage which serializes an object and that object can be used for function call.

          Whereas if I understand correctly, WASM can be provided with host approved JS functions to call directly in importObject. This seems more convenient and fast.

          But for a plugin system, many people would prefer to write plugins in JS itself, so for WASM plugins, they might have to be compiled to WASM first. Dont know how if there is a mature implementation of JS->WASM.

    • simonask 5 hours ago

      I’m using WASM as the modding interface in my game. (I’m using wasmtime from Rust, but same principle.)

      Main benefits are isolation, binary portability, and hot reload.

    • crabmusket 6 hours ago

      Take that API scraping script example. Imagine next you want to build a platform where you run code written by your users who want to e.g. scrape APIs. Think ParseHub I guess? Zapier is another good example.

      You'd let them write in Rust or some other language that can target WASM, then you'd run the WASM blobs in a controlled sandboxed execution environment in your platform.

      • Groxx 6 hours ago

        So basically: what every single platform with plugins should be doing to protect their users. Or similar via some other language that allows sandboxing, e.g. Lua.

        • lll-o-lll 4 hours ago

          Yeah, but the plugins can be written in Rust!

          OK, OK, it’s a bad example. WASM is language agnostic though, so as more languages can target WASM, then the possible advantage is programming language agnosticism. If I have some code, I don’t have to re-write it in Lua.

      • iknowstuff 6 hours ago
    • csomar 4 hours ago

      I think the biggest company using wasm in production is figma (though there might be others). Otherwise, here is an example where wasm shines. Say you have an editor (rvim) and you want to support plugins. Usually, you’ll have a language interpreter and ask developers to develop in this language. With wasm, you can give them the freedom to use whatever stack they want. Then you expose an interface for their wasm artifacts. This abstract the host OS away. Another example is game mods/plugins.

    • sroussey 6 hours ago

      ONNX has a WASM backend for running models in a browser. It’s what transformer.js (from HuggingFace) uses behind the scenes.

    • xn 6 hours ago

      I've used wasm to write web applications in Go that run in the browser, both HTML applications (https://github.com/octoberswimmer/masc) and TUI apps using xterm.js (https://github.com/charmbracelet/bubbletea/pull/887).

    • dgfitz 6 hours ago

      I cross-compile a native qt app in windows, Mac, and Linux variants. It’s pretty neat to see it compile in wasm as well.

    • colordrops 5 hours ago

      Everyone else has answered about WASM, so I'll answer about raspberry pi. I've got 5 of them. One is running Home Assistant for all my home automation and camera recording. One is running a quadruped that I built. And three are connected to three sets of speakers around the house running a home-rolled Sonos-like setup so I can stream the same music all around the house from my phone.

  • int_19h 5 hours ago

    Is Wasmer still openly adversarial wrt the Bytecode Alliance?

  • wg0 5 hours ago

    Sorry to be that guy but what's the business model for all these web assembly runtime companies?

    • jsheard 5 hours ago

      This one runs their own serverless platform that you can deploy your WASM apps to, but their pricing is... vague.

  • thrdbndndn 4 hours ago

    God, please stop using random AI-generated images in a release post..

    • spretzer 4 hours ago

      What is the issue with AI-generated images? Just being overdone in general? Or ethical concerns?

      • thrdbndndn 3 hours ago

        Makes your article looks cheap like a random blogspam. My personal opinion, obviously.