Live data from Hacker News

Wasmer 5.0

wasmer.io

81–90 of 90 posts

Re: Wasmer 5.0

#81
post #49

Earlier quoted context omitted.

For sandboxing in JS, we can use sandboxed iframes or webworkers. Both of those communicate to hosted code via postmessage which serializes an object and this can be used as a base for implementing function calls. 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 pref…

> 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. Not everyone tho, which is kinda the point of abstracting away your language for plugins. People like Python, Lua, Go, Rust, etc... Some do like JS of course, but not everybody. Re: mature implementations, I…

> I would guess worst case QuickJS probably can compile to WASM

That's actually exactly what Figma is doing for their plugins. [1] Seems to be working ok, though not without some pain [2].

[1] https://www.figma.com/blog/an-update-on-plugin-security/

[2] https://macwright.com/2024/03/29/figma-plugins

Re: Wasmer 5.0

#82

Earlier quoted context omitted.

What's the difference between this and a generic photo from one of the dozens stock photo catalogs? Is this somehow "cheaper" because it's "AI" generated? Using stock photos is also cheap (free or cents per)... Second, does anyone really care? Has anyone spent more than half a second looking at a generic picture on an unrelated article? Does the generic hoodie hacker look good on security articles? Or the earth with…

> What's the difference between this and a generic photo from one of the dozens stock photo catalogs? None really, using a stock photo in a blog post is also a stupid idea. Just don't add any image if it isn't needed to get an important point across.

I personally find title images pretty helpful to remember a certain blog post, quickly identify it when I have several of the same blog open as tabs etc.

Of course it can be overdone, but it definitely does add utility for me at least sometimes.

Re: Wasmer 5.0

#83

Earlier quoted context omitted.

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 -…

> 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.

Not the OP, but most web-based multiplayer games use a server backend to communicate between the multiple players.

> connecting to a rust web server for the game logic? And you want to embed that server by compiling to wasm?

I would assume so, and it being in WASM means they can use the exact same binary code on the server and in the webbrowser.

You could of course do the same thing by writing in Javascript (running in Node on the server or in the browser) but then you are in JS instead of Rust.

Re: Wasmer 5.0

#84
post #5

Earlier quoted context omitted.

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.

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.

Yes, that's right. It's just another option that lets you do that in a different (better?) way, and doesn't force all your users to write Lua.

Re: Wasmer 5.0

#85

I really don't know what problem(s) this solves. Don't all the javascript runtimes already have wasm engines built into the runtimes?

You don't need to carry around a whole Javascript engine when all you want is running some WASM/WASI code. Granted, the real-world differences aren't all that big: - wasmer: single 45 MByte exe - wasmtime: single 28 MByte exe - node.js: 87 MByte, lots of individual files - deno: 186 MByte over two executables (deno and denort not sure what denort is though) As an extreme outlier, there's wasm3 which is a WASI interpr…

Is this (size) an issue in the real world?

Re: Wasmer 5.0

#86

Earlier quoted context omitted.

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.

> 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. It's funny that every time an article on new functionality for eBPF appears in LWN everybody is like "why don't they just use WASM???". More seriously, a forward only language is by definition too strict for the general c…

forward only requires you to think harder. that's very true.

Re: Wasmer 5.0

#87
post #40

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.

Take a look at Electrobun. It’s a Tauri alternative where you write typescript instead of rust. App bundles as small as 16MB and it creates update patches for your app as small as 4KB.

Written in zig and Bun, and uses the system webview by default.

Re: Wasmer 5.0

#88

Earlier quoted context omitted.

You don't need to carry around a whole Javascript engine when all you want is running some WASM/WASI code. Granted, the real-world differences aren't all that big: - wasmer: single 45 MByte exe - wasmtime: single 28 MByte exe - node.js: 87 MByte, lots of individual files - deno: 186 MByte over two executables (deno and denort not sure what denort is though) As an extreme outlier, there's wasm3 which is a WASI interpr…

Is this (size) an issue in the real world?

It depends what real world is for you. In embedded or with low bandwith it might.

Re: Wasmer 5.0

#89

Earlier quoted context omitted.

You don't need to carry around a whole Javascript engine when all you want is running some WASM/WASI code. Granted, the real-world differences aren't all that big: - wasmer: single 45 MByte exe - wasmtime: single 28 MByte exe - node.js: 87 MByte, lots of individual files - deno: 186 MByte over two executables (deno and denort not sure what denort is though) As an extreme outlier, there's wasm3 which is a WASI interpr…

Is this (size) an issue in the real world?

On desktop and server machines probably not. But more code also means a bigger attack surface.

Re: Wasmer 5.0

#90
post #83

Earlier quoted context omitted.

> 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.

Not the OP, but most web-based multiplayer games use a server backend to communicate between the multiple players. > connecting to a rust web server for the game logic? And you want to embed that server by compiling to wasm? I would assume so, and it being in WASM means they can use the exact same binary code on the server and in the webbrowser. You could of course do the same thing by writing in Javascript (running…

Thank you, that clears it up for me. Tech has changed a lot since I was exposed to web programming.
Post reply on HN