7 ms·
WinterJS
- charcircuit 3y agoWhat's the point of running a the javascript virtual machine on the WASM virtual machine?
- norman784 3y agoI suppose that for the platform provider it's easier to ship only one runtime and then run everything over it, also might be better in terms of security because of the sandboxed nature of WASM. Once WASI gets stabilized, you will also have the option to mix JS with the other languages that already target WASM, so your infra could be build on top of different languages and change them according to the requirements, just think of you build your entire system in JS, compile in modules and deploy them as components, then you can swap one component at the time when necessary.
- lionkor 3y agoCpu architectures and hardware is incompatible, so OSs provide a layer across. OSs are incompatible, so browsers and their virtual machines (i.e. javascript runtimes) provide a layer across. Browsers are incompatible (in some ways more than others), so wasm provides a layer across. Wasm is cool, so we backport wasm + the vm + the browser + the OS to a new program, which abstracts all that again. Cross platform is hard and hasn't gotten any easier.
- downvotetruth 3y agoEnabling browsers to drop the support of the monster that is JavaScript in favor of WASM. Thus, the winter or lack of JS.
- lionkor 3y agoI'm sure we are on a good path, sure, but unless there is a monopoly, there will always be a need for cross-compatible software. We should build software like that, like we've been doing in C++ and Rust and languages which are built to acknowledge that platforms are different.
- charcircuit 3y agoJavascript is already cross platform
- chiubaca 3y agoso, is this a cloud flare workers alternative?
- dynamite-bud 3y agoYes, it is. It is based on cloudflare's winter-cg spec
- TekMol 3y agoThey say running the hello world example "is as simple as this:" wasmer run wasmer/winterjs --dir=. serviceworker.js But ... what does that mean? After I turned on a new computer, I certainly can't type that command and have it running "a JavaScript Service Workers server written in Rust, that uses the SpiderMonkey runtime to execute JavaScript" as they put it. What is the background here? Say I have a newly installed Debian 12 machine - how do I get to use this thing?
- atoav 3y agoOn a tangent here: many IT people really suck at explaining things from the start. I sometimes wonder if they fail to remember a time where it was them that didn't know e.g. what a console actually is and how it can be used, before giving the person opposite an non-explaination like: "You just have to do $CLI-APPLICATION-TASK" Not that I have anything against command line applications (quite the opposite) — but if you, the trusty IT person, recommend someone to do X, you better check if the know the things required to even understand what X is.
- thaumasiotes 3y ago> I sometimes wonder if they fail to remember a time where it was them that didn't know e.g. what a console actually is and how it can be used To be fair, the reason I'd fail to remember such a time is the same reason that I can't remember anything else from that time. Most people don't remember being a baby. Unless you think knowing the word "console" is the important part there. I would have just said "DOS".
- atoav 3y agoSo you learned to use a command line interface when you were a baby? I have been programming for half of my life since I was a teenager, but I can still remember how frustrating it was that some things just were assumed. I still remember when software without a GUI was an unpleasant thing for me, I can still remember struggling to understand how all the web technologies tie together and so on. Understanding that what you know isn't automatically self-evident or obvious even to a person that might be more intelligent than yourself is an important skill in the IT sector if you want to communicate effectively.
- hackandthink 3y agoSome fancy indirectly referenced stuff: Taking Javascript Code and generating a specialized Interpreter for this Code which can be compiled to Webassembly. (Chris Fallin) https://en.wikipedia.org/wiki/Partial_evaluation#Futamura_projections https://en.wikipedia.org/wiki/Partial_evaluation#Futamura_pr... via https://github.com/cfallin/weval https://github.com/cfallin/weval
- vasergen 3y agoWhat does it mean "blazing fast"? Every new thing is blazingly fast nowadays.. deno, bun, turbopack, etc. I don't even know what does it mean to me as a user, does it really super fast or it is just some fancy words. "blazingly fast" compared to what?
- o_m 3y agoIt is a meme, but at the same time performance has become a popular selling point again.
- lionkor 3y agoSaying "It's super fast" isn't a selling point. facebook/zstd has performance as a selling point, by doing extensive benchmarks and presenting them.
- resonious 3y agoI'm starting to wonder why people are saying their stuff is fast. Much of the time there's no benchmark.
- oefrha 3y agoEspecially considering that SpiderMonkey is definitively not blazing fast compared to V8 or JSC, for common web workloads anyway. At most it’s comparable. Somehow doubt adding a layer of wasm indirection makes it faster. But I suppose everything is indeed blazing fast when compared to no target at all.
- pjmlp 3y agoYeah they have to sell bytecode based runtimes, never done before.
- lionkor 3y agoThey use Rust (i like Rust), so they have to somehow convince themselves that their mess of overly abstracted code strewn across 2000 crates is, in fact, very very fast and it's all worth it. I think people use a language like Rust because they hear its got potential for performance, but its told to them like so: "Rust is blazing fast!". So they perpetuate that idea, and just hope to god that their program, even if its horribly cache-inefficient, allocates aggressively, context switches constantly, etc. is still fast enough that it feels fast. Also, of course, on dev machines which often have high end hardware, it probably does feel very fast. "I can't even see any time between input and result, its so fast!", said the programmer running his script on an overclocked i9-9900k with nothing else open To be clear, nothing about Rust or C or C++ is fast. They allow you to write faster code than most other languages, some more easily than others. All of those you can easily write the slowest code imaginable in. Try doing a bunch of very expensive copies in C# or Java - youd have to go out of your way. In C++ its default behavior.
- Muromec 3y agoAfter reading the whole page I still don’t get what it does, why I need it and how exactly it’s cool. I mean okey, JavaScript ant rust, yeah. Aaand?
- joshxyz 3y agodude i went there and tried to prove you wrong but you're right. what's the freakin use case here, do i need gpt4 to eli5 this page?
- danielbln 3y agoI ran it through Claude-2: Here is an ELI5 explanation of the Wasmer blog post announcing WinterJS: WinterJS is a new way to run JavaScript Service Workers that Wasmer created. Service Workers are little programs that run in your web browser to make websites work better. The normal way to run Service Workers is using Node.js. But Node.js can be slow and heavy.Wasmer made WinterJS using the Rust programming language. Rust makes it very fast! WinterJS also uses the same JavaScript engine that Firefox uses, called SpiderMonkey. This makes it work the same way as a web browser.So WinterJS lets you run Service Workers in a fast and lightweight way, without needing Node.js. You can run it on your computer with a simple command.WinterJS is special because it can also be compiled to WebAssembly. This means it can run in Wasmer Edge or even directly in your web browser!
- indeyets 3y agoWhy do I need service workers as standalone programs on the backend? What am I missing by not running them? Looks like another way to run server app Fair question
- elvis19 3y agoCan i use this to compile Javascript to .wasm and run it with Apache mod_wasm?
- hobofan 3y agoI don't think that's the intended use-case for this. If you want to do this, I think something like ComponentizeJS[0] is what you would be looking for. As far as I can tell you'd also need to create WIT (Wasm Interface Type) definitions for the interface(s) that mod_wasm expects for its WASM modules, as they don't provide them themselves. [0]: https://github.com/bytecodealliance/componentize-js https://github.com/bytecodealliance/componentize-js
- politelemon 3y ago> The WinterJS server is published in Wasmer as wasmer/winterjs. Struggling with the assumed knowledge here, and having to hop a number of pages. What is wasmer? Why is this published there and not npm. I think there is a new set or layer of terminology, some very close to each other, that the wasm world introduces but which nobody wants to explain. That leads to confusing when trying to understand a project like this.
- dkwr 3y agoYou need to be careful when looking at wasmer. They build upon the Wasm and WASI standard their own stuff like WASIX. Running WASIX compatible services/stuff may not be compatible with other WASI runtimes. Furthermore they do offer their own package manager to serve Wasm modules. Which is why it is published there. They are doing a lot of effort to speed up the development around Wasm, but you need to know what you can use with your run time and what is the "real" Wasm/WASI standard.
- ushakov 3y agoWinterJS doesn’t support any other runtimes other than wasmer though?
- hobofan 3y agoYes, as it's based on WASIX, the superset of WASI created by Wasmer, that is (and probably will be) the only runtime that will run WinterJS.
- crabmusket 3y agoI actually tried writing something like this one weekend last year. I really like the idea of the https://wintercg.org/ https://wintercg.org/ group this runtime is named after, and I wanted a non-Node, non-Cloudflare, non-X version just to explore what it took to implement some of the APIs they've standardised on. It was based on QuickJS and Tokio and never got far. Instead of implementing builtins in C, as the article suggests you would with QuickJS, I was implementing them in JS. I think I got to the point where the very simplest hello world would work. Anyway, I'm glad someone else has done it.
- pleoxy 3y agoPretty confusing to call their target a "service worker" when that is also the name of an in browser platform. Kind of a mess of a post.
- throwoutway 3y agoMeta: with the double top-banner and the massive side-bar and gutters, the readable space for the blog is <30% of the page
- remram 3y agoIt is weird that this is so high up in the frontpage yet no one in the comments understands what it is. Hopefully someone from the project team sees this and comes up with an understandable description.
- CharlesW 3y agoI'll take a shot, based on the first paragraph: WinterJS is a JavaScript Service Workers¹ server. It's for JavaScript runtimes that aren't browsers², so that you can write JavaScript Service Workers that run (fast!) on those non-browser platforms. ¹ Service Workers allow developers to write code that runs in the background, independent of the main appliaction thread. ² Like Cloudflare Workers, Deno Deploy, Vercel, and Wasmer Edge.
- remram 3y ago> It's for JavaScript runtimes that aren't browsers Do you mean: "it's *a* JavaScript runtime that isn't a browser"? You are implying that JavaScript runtimes would be the users of WinterJS. That has me even more confused.
- CharlesW 3y ago> Do you mean: "it's *a* JavaScript runtime that isn't a browser"? Good catch! It is indeed a JavaScript runtime for Service Workers. By "for", I was attempting to make the point that it's intended to be deployed to non-browser JavaScript/Wasm runtimes.
- remram 3y agoI am still confused, it's a JavaScript runtime intended to be deployed to JavaScript/Wasm runtimes? Why does a JavaScript runtime need a JavaScript runtime?
- CharlesW 3y ago> I am still confused, it's a JavaScript runtime intended to be deployed to JavaScript/Wasm runtimes? Seemingly. > Why does a JavaScript runtime need a JavaScript runtime? Because if you want to create a Service Worker server for CloudFlare Workers and other JavaScript/Wasm runtimes, that's the only option for doing that AFAIK. FWIW, this isn't a new idea. For example, Figma uses QuickJS (https://bellard.org/quickjs/ https://bellard.org/quickjs/) for their plug-in runtime: https://www.figma.com/blog/an-update-on-plugin-security/ https://www.figma.com/blog/an-update-on-plugin-security/