Live data from Hacker News

Wgpu-rs on the web

gfx-rs.github.io

11–20 of 63 posts

Re: Wgpu-rs on the web

#11
post #4

This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I'd even be willing to bet that there are popular frameworks in use by major websites that discard the DOM altogether for something simpler and faster. There's a reason why this has to happen, too. My sincere hope is that Mozilla and the Rust/Browser l…

https://www.destroyallsoftware.com/talks/the-birth-and-death...

This is becoming (somewhat) more true every day.

Re: Wgpu-rs on the web

#12
post #4

This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I'd even be willing to bet that there are popular frameworks in use by major websites that discard the DOM altogether for something simpler and faster. There's a reason why this has to happen, too. My sincere hope is that Mozilla and the Rust/Browser l…

What do you mean by “browser toolkit”? If you mean “thing that people make web apps with” (like React or like you might imagine Qt being, though it’s not for the web platform), there is not a chance that this will happen by 2025. Zero.

For starters, Rust: Rust is just too complex to be the most popular language when something like JavaScript exists which is faster and easier to get started with, and generally good enough. It has niche usage and will steadily grow, but it’s not going to take over the space any time soon, and probably never will. I say this as a Rust developer for seven years and a web developer for more than fifteen years.

Then the other part, discarding the DOM altogether: there are way too many pieces of functionality that the browser provides that currently cannot be implemented in web user space, for this to become mainstream any time soon. For example: correct scrolling, standard keyboard and mouse event handling, and accessibility. The idea that you would go from quite a few pieces of major functionality completely non-existent in browsers and specs (most of these issues aren’t even being talked about) to mastery of the space within five years is unreasonable.

For further shared abstractions, many web APIs are developed and continue to be developed. Other experiments like WASI exist. WebAssembly has scope to be a solid foundation for this sort of thing. But applying all of the interesting web APIs to desktop and mobile platforms, that’s not really something that Mozilla, Rust or browser developers can or should do anything about. They have somewhere between no and extremely limited clout in such spaces.

Re: Wgpu-rs on the web

#13
post #4

This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I'd even be willing to bet that there are popular frameworks in use by major websites that discard the DOM altogether for something simpler and faster. There's a reason why this has to happen, too. My sincere hope is that Mozilla and the Rust/Browser l…

I wish it was true, and maybe the web would be better off if it happened… but I don't see it happening.

The JS ecosystem is huge and thriving. TypeScript is good enough that there's no burning need to replace it.

Re: Wgpu-rs on the web

#14
post #4

This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I'd even be willing to bet that there are popular frameworks in use by major websites that discard the DOM altogether for something simpler and faster. There's a reason why this has to happen, too. My sincere hope is that Mozilla and the Rust/Browser l…

I don't think that's going to happen and I hope that's not going to happen. DOM provides good abstraction of UI elements, which helps with accessibility, scrolling behaviour with the same feel as OS, standard text utils like selection, copy-paste. Using many incompatible libraries for that would lead to neo-Flash nightmare.

What I believe is going to happen is splitting more complex web applications into frontend part - written in JS - and backend + graphics part - provided as Wasm, possibly written in Rust.

Re: Wgpu-rs on the web

#15
post #5
post #3

Can it do sha3 hashing in a web browser on the gpu?

Yes, so does WebGL and with the same efficiency. Partial hash inversion is an embarrassingly parallel problem: computing a hash from a random number is independent from the other random numbers you want to compute hashes for, also it is a computation bound problem and not memory bound. It means you can build a fairly efficient partial inverse finder by running many fragment shaders ("pixels") in parallel and only dra…

Can you share an example or tutorial?

Re: Wgpu-rs on the web

#16
One of the things that use wgpu-rs is Iced[1], a cross-platform GUI Library inspired by the Elm Architecture.

Although the project started around May 2019 and is still highly experimental, it looks like they got a lot of progress made and things look promising! The interest seems incredible: they have 5.4K stars on GitHub (amazing for such a young project) and there are lots of impressive examples[2].

As someone who just learned about the project: hope this takes off!!! A lightweight, simple to use GUI toolkit that can run on the browser and desktop is really something developers desperately want.

[1] https://github.com/hecrj/iced [2] https://github.com/hecrj/iced/tree/master/examples

Re: Wgpu-rs on the web

#17
post #4

This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I'd even be willing to bet that there are popular frameworks in use by major websites that discard the DOM altogether for something simpler and faster. There's a reason why this has to happen, too. My sincere hope is that Mozilla and the Rust/Browser l…

Web scripting trends are pretty hard to predict so who knows. The basic obstacle for this is that Rust is much harder to pick up than other JSVM targeting languages and the "doing without GC in exchange for hard to understand borrow checker" tradeoff isn't really valuable on the web.

Re: Wgpu-rs on the web

#18
post #4

This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I'd even be willing to bet that there are popular frameworks in use by major websites that discard the DOM altogether for something simpler and faster. There's a reason why this has to happen, too. My sincere hope is that Mozilla and the Rust/Browser l…

TBH, I doubt it, writing "high level" Rust requires a too big "runtime portion" (in the same sense of "runtime" as the stdlib in C++, which also tends to bloat up executables), while "embedded style" minimal Rust without such a "runtime part" is so low-level you could just as well write C code (which is also "memory safe" in that environment because of WASM).

And even in the best case, a WASM blob still has a hard time beating a bit of Javascript if it is just used to glue a couple of browser APIs together (and in such a situation, the good or bad qualities of that "glue language" don't matter much).

Hybrid JS/WASM applications make a lot more sense, where some small performance-critical parts are implemented in WASM in a "runtime-free language", glued together by Javascript (similar to how python is often used as glue between functionality implemented in native DLLs).

Re: Wgpu-rs on the web

#19
post #4

This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I'd even be willing to bet that there are popular frameworks in use by major websites that discard the DOM altogether for something simpler and faster. There's a reason why this has to happen, too. My sincere hope is that Mozilla and the Rust/Browser l…

> I really hope the performant web slays the app store. That's the dumbest trap we ever fell for. I'd love to visit a website and be playing native Minecraft in seconds. Sans Google Play or the App Store, with no bullshit monopoly tax.

I don't, unless certain criteria are met.

There is a consumer-friendly side of apps that is often overlooked in these types of conversations: generally, I get to decide when to update my apps, and the developer can't uninstall their app off my phone without my permission. Moving from apps to the web shifts the balance of power even further from user to developer.

There are some apps (that require internet access) for which this is not true. For those, I share your sentiment; spotify has no reason to be an app. It's also possible to implement this amount of user control with the web, by caching the full version of a page, when you add it to your home screen (for example), and only replacing it after an explicit prompt (as a setting, ie auto-update).

Until that happens, though, I don't wish for the death of app stores. Especially, f-droid is a great ecosystem.

Re: Wgpu-rs on the web

#20
post #4

This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I'd even be willing to bet that there are popular frameworks in use by major websites that discard the DOM altogether for something simpler and faster. There's a reason why this has to happen, too. My sincere hope is that Mozilla and the Rust/Browser l…

TBH, I doubt it, writing "high level" Rust requires a too big "runtime portion" (in the same sense of "runtime" as the stdlib in C++, which also tends to bloat up executables), while "embedded style" minimal Rust without such a "runtime part" is so low-level you could just as well write C code (which is also "memory safe" in that environment because of WASM). And even in the best case, a WASM blob still has a hard ti…

Are you in the habit of using Rust + WASM? From how you’re wording this, I suspect not. Rust really doesn’t require a large runtime (until you do something that requires Unicode tables, then you pay a certain tax), and the difference between high-level and embedded styles is normally small to nothing—the whole concept of zero-cost abstractions is normally talking about performance, but correlates extremely strongly with code size too; such abstraction layers typically compile out of existence.

Also there’s still a fairly big difference between a more frugal style of Rust and C. Just because it can’t cause arbitrary code execution and the likes doesn’t make C safe to use.

Yes, when developing for the web people will hopefully pay a little more attention to binary size, because WASM does have a tendency to make big code blobs easier to produce, especially if you’re using generics liberally.

Finally, although at present the browser WASM story requires it to interact with the browser through JavaScript, that limitation is planned to be removed.

Post reply on HN