Live data from Hacker News

Transitioning Firefox's rendering engine from Gecko to Servo

jensimmons.com

191–200 of 219 posts

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#191

Earlier quoted context omitted.

Except, like, JS isn't going to die any time soon, and realistically, implementing a new JS or WASM VM isn't actually that interesting to do: the big risk in a JITing VM that Rust cannot save you from is behaviour of your JITed code, which makes memory safety far harder to enforce.

Right, JS isn't going anywhere. But once WASM is able to run everywhere, anybody attempting to make high performance web apps would ideally want to write it in WASM. A lot of what JS does on the web is plenty fast and won't really benefit much from JS being multi-threaded/faster. Sites using JS to run simple scripts or to fire api calls/etc. will continue to use JS, no reason to use WASM. Also, I believe WASM is trul…

WASM isn't machine code: if it were, it wouldn't be universal which is a fundamental requirement of the web. (Well, okay, it's compiled code—it is, after all, compiled from C/C++/etc., but in the same way JS is compiled to byte code in VMs today.) As such, there's a further compilation step needed from WASM to machine code to get near-native performance out of it.

The existing WASM implementations do a mixture of JITing code at load-time and JITing code at first-call, depending on the size of the WASM blob, AFAIK. The gain performance wise over asm.js is primarily in parse-time, as far as I'm aware.

WASM VM itself is perfectly possible to be memory safe: WASM code cannot read outside of the memory allocated to it (and malloc/free are implemented on top of that memory allocated to the VM, hence there's memory safety at the VM level).

The big problems come when you need to guarantee your JIT code doesn't violate memory safety, and that's something Rust's type system cannot (currently) solve. You need guarantees that the generated code will never have any memory access errors, and will never race for memory reads/writes, because it's running with the privilege of the VM, not the limited powers of the WASM code running within it.

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#192
post #123

Earlier quoted context omitted.

Presto was only still being used in Opera Mini, it had been swapped out for Blink in the desktop and full-fat mobile versions.

I know, but I'm replying from a Presto-powered desktop browser :) . People have been asking for open-sourcing of it ever since the switch happened, but I guess we'll never see that happen.

Realistically, at this point, I'd say it won't happen. I wouldn't have ruled out Opera Software ASA open-sourcing it once it was a mere historical curiosity, but with it having gone to the new owners of the consumer browser business, I can't see it happening.

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#193
post #156
post #140

> Going forward, it will be much easier and more enjoyable to implement new CSS properties. Which makes it easier for folks in the open source community to contribute. Which makes new things come out faster. I had never really thought of Servo in these terms before, but it makes a lot of sense. Mozilla, being a nonprofit, can't compete with Google / Apple / Microsoft doing things their way . They inherently have a gr…

Mozilla is really just another software company owned by a nonprofit. They have hundreds of millions in revenue and have been "profitable" in many/all years. But they are definitely much smaller than Google/Apple/MS and can't benefit from ecosystem lock-in effects.

> Mozilla is really just another software company owned by a nonprofit

It depends on how one defines "just another software company", but I don't agree with that characterization:

Our mission is to ensure the Internet is a global public resource, open and accessible to all. An Internet that truly puts people first, where individuals can shape their own experience and are empowered, safe and independent.

Much more of the same here: https://www.mozilla.org/en-US/mission/

I don't see Google, Facebook, Microsoft, or other software companies aggressively, creatively pursuing those goals (and achieving them). If Mozilla was just another software company, would there even be an open web today?

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#194

Earlier quoted context omitted.

AFAIK, about 40% of Firefox users don't have any add-ons.

Furthermore, the recent e10s transition was already tree shake of the long tail of ancient add-ons in terms of how many still had old bindings and used ancient versions of the NPAPI. Then there is the fact that every other browser has, or is in the process, dropped any notion of direct native add-on APIs and an increasing majority of actively developed add-ons for all browsers is now modern "Chrome-style" JS+HTML com…

You seem to be confusing NPAPI plugins with browser extensions.

Firefox doesn't allow addons that contain binary XPCOM components anymore. Everything has to be JS, whether the addon is XPCOM based, addon SDK (JetPack) based, or WebExtensions-based.

NPAPI is deprecated and is to the point where it is only used for Flash.

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#195

Call caniuse, flexbugs, quirksmode, stackoverflow and it's companion codepen on the deck, there will be some action! creating a renderer in 90% of the work, the other 90% is documenting its bugs and quirks.

I for one hope we're getting better at that: we're sharing more tests across browsers than ever before, and I think that's quite possibly going to end up being the de-facto norm for all new tests this year.

Of course, that doesn't mean that we'll get rid of all bugs, but it does mean that more bugs should be found before shipping.

(As a disclaimer: this is essentially the majority of what I've got paid to do over the past year-and-a-bit.)

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#196

This seems apt: https://www.joelonsoftware.com/2000/04/06/things-you-should-... Mozilla spending time on this suggests Mozilla doesn't know what to spend time on.

Joel's article is about doing everything from scratch, while if I read it correctly the article talks about doing things in-place, alongside normal use and development.

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#197

Earlier quoted context omitted.

Furthermore, the recent e10s transition was already tree shake of the long tail of ancient add-ons in terms of how many still had old bindings and used ancient versions of the NPAPI. Then there is the fact that every other browser has, or is in the process, dropped any notion of direct native add-on APIs and an increasing majority of actively developed add-ons for all browsers is now modern "Chrome-style" JS+HTML com…

You seem to be confusing NPAPI plugins with browser extensions. Firefox doesn't allow addons that contain binary XPCOM components anymore. Everything has to be JS, whether the addon is XPCOM based, addon SDK (JetPack) based, or WebExtensions-based. NPAPI is deprecated and is to the point where it is only used for Flash.

Sorry, yes I was using NPAPI as a handwaving shorthand for both NPAPI and binary XPCOM to save time. I appreciate the extra technical detail, though. (Because technically correct is the best kind of correct.)

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#198

Earlier quoted context omitted.

Yes. However, a crappy, leaky, JS engine running crappy JS code will steal all resources even quicker. I hope a JS engine built with Rust smart ptrs will be less leaky than one built in C/C++. In my experience, hand rolled memory pooling systems can be very leaky.

I wonder if it would be possible to write a JS engine in Rust that would essentially make multi-threading JS possible... Use Rust's concurrency safety to pass resources around threads running JS. Doing this without making any changes to JS. Of course Node would then also be obsolete...

The challenges in parallelizing JS have very little to do with its implementation language and almost everything to do with JS itself. Rust can't help you there.

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#199
post #7

Earlier quoted context omitted.

Looking forward to it too; this is a big deal because it will put a Rust implementation on many millions of desktops. I'm totally fed up with CPU and memory hogging browser bloat on my laptop. My dev env runs so much better when I kill all Chrome processes. I know that the article is only talking about the render engine, and not JavaScript, which I suspect is the main browser bloat culprit , but I'm still hopeful. Br…

It's not going to change that. No matter how efficient you make the JS engine, crappy JS will still steal all your ressouces.

I'm hoping it spurs a resurgence in real desktop apps, then we shouldn't have to worry about bloated javascript.

Re: Transitioning Firefox's rendering engine from Gecko to Servo

#200

Earlier quoted context omitted.

Rust is neither faster nor more efficient than C++.... its benefits lie elsewhere.

Rust should be just as fast as C++ and C. Benchmarks are hard of course because optimizations and such. But if Rust is significantly slower, than it is a bug.

I hope it pans out and doesn't become the next "java will catch up to c one day".
Post reply on HN