Live data from Hacker News

How Stylo Brought Rust and Servo to Firefox

bholley.net

81–90 of 199 posts

Re: How Stylo Brought Rust and Servo to Firefox

#81

One thing I've been wondering is that Stylo and Webrender can parallelize CSS and Paint, respectively, but I haven't seen any mention in Project Quantum (the project to integrate Servo components into Firefox/Gecko) of any component to parallelize layout, which is probably the biggest bottleneck on the web at the moment. Is parallel layout something which can only be done through a full rewrite, hence with Servo, and…

Integrating layout is a lot more challenging.

Now, once stylo and webrender are in play, ideally layout can just fit in between. All the interfacing already exists from Servo.

However, there are a lot more things in Firefox that talk to layout. This would need work, more work than Stylo.

But this isn't the major issue. The major issue is that Servo's layout has a lot of missing pieces, a lot more than was the case with its style system. It's hard to incrementally replace layout the way webrender did with rendering (fall back when you can't render, render to texture, include it).

So it's doable, but a lot more work.

Re: How Stylo Brought Rust and Servo to Firefox

#83
post #42

It's gratifying to see how successfully the same organization has learned from the debacle that was the rewrite from Netscape 4 to Mozilla in the first place. That time, they didn't release for years, losing market share and ceding the web to Internet Explorer for the next decade. Joel Spolsky wrote multiple articles[1][2] pointing out their folly. This time, their "multiple-moonshot effort" is paying off big-time be…

Joel is making two separate claims there, though he doesn't cleanly distinguish them.

One is that rewriting from scratch is going to give you a worse result than incremental change from a technical point of view (the « absolutely no reason to believe that you are going to do a better job than you did the first time » bit).

The second is that independent of the technical merits, rewriting from scratch will be a bad commercial decision (the « throwing away your market leadership » bit).

We now know much more about how this turned out for his chosen example, and I think it's clear he was entirely wrong about the first claim (which he spends most of his time discussing). Gecko was a great technical success, and the cross-platform XUL stuff he complains about turned out to have many advantages (supporting plenty of innovation in addons which I don't think we'd have seen otherwise).

It's less clear whether he's right about the second: certainly Netscape did cede the field to IE for several years, but maybe that would have happened anyway: Netscape 4 wasn't much of a platform to build on. I think mozilla.org considered as a business has done better than most people would have expected in 2000.

Re: How Stylo Brought Rust and Servo to Firefox

#84
It might sound very naive to say this, but I found it very cool that it was someone from the States, an Aussie and a Spaniard working on this, open source is something magical when you think about it. Props to everyone involved, all those projects sound like a lot of fun for a good cause.

Re: How Stylo Brought Rust and Servo to Firefox

#85

Earlier quoted context omitted.

What I wonder, and I do not mean this in negative way, is whether this would have happened in a more commercially oriented organisation. Mozilla remains a foundation, and I consider Rust a fruit of their labour in itself. To put it another way, I find it hard to justify developing Rust just for a web browser. But if you consider it from the perspective of a foundation developing tools for the developer community as a…

It's certainly true that corporations do put a lot of work into languages and runtimes. Apple created LLVM and clang, Microsoft created .NET and CLR with C#, F#, VB.NET, etc. These projects were valuable to Apple and Microsoft for a variety of reasons: * promoting their IDE: XCode builds faster, and has better error messages. You can use any .NET language with Visual Studio in the same project. * promoting their plat…

> Apple created LLVM and clang

To be specific, LLVM started as an academic project by Vikram Adve and Chris Lattner in 2000. Apple hired Chris Lattner in 2005 to work on LLVM for Apple. Clang, though, does appear to have been an Apple project, being introduced by Steve Naroff of Apple in 2007 as an open-source project.

Re: How Stylo Brought Rust and Servo to Firefox

#86
post #45

> For example, register allocation is a tedious process that bedeviled assembly programmers, whereas higher-level languages like C++ handle it automatically and get it right every single time. Ideal register allocation is NP-complete, so a compiler can't get it right every single time. I'm not sure how good in practice modern compilers are at this, but would be curious to know if there's some asm writers who can actu…

Optimal register allocation has been polynomial time for more than 10 years - for some definition of optimal. IIRC it started with programs in SSA form and has dropped that requirement more recently. Modern GCC uses SSA form and I think LLVM might too.

Re: How Stylo Brought Rust and Servo to Firefox

#87

Earlier quoted context omitted.

Speaking of which: does anyone know if some new optimization land in the beta versions a couple of days ago? Or if some bug that caused delays on Linux got fixed? I updated my developer version yesterday and it was as if Firefox - already ludicrously fast compared to before - turned on the turbo booster. Obviously, I'm not complaining ;)

The next Servo component is webrender and I'm not certain on if it has been flagged to on for developer edition but that would certainly affect speed.

I'd be very surprised if that wasn't announced somewhere.

Guess it must be a specific bug that affected my hardware more than the average person then.

Re: How Stylo Brought Rust and Servo to Firefox

#88
I love Firefox Quantum and it has replaced Chrome as my browser at home. It's memory consumption is far lower with the same amount of tabs open.

That said, why does it perform slower than Chrome on most benchmarks? Is it due to the Chrome team doing much more grunt work regarding parallelism and asynchronous I/O? Or are there still features in the current Firefox build that still call the original engine?

Does Rust have a runtime penalty as Golang does?

Re: How Stylo Brought Rust and Servo to Firefox

#89

I love Firefox Quantum and it has replaced Chrome as my browser at home. It's memory consumption is far lower with the same amount of tabs open. That said, why does it perform slower than Chrome on most benchmarks? Is it due to the Chrome team doing much more grunt work regarding parallelism and asynchronous I/O? Or are there still features in the current Firefox build that still call the original engine? Does Rust h…

> most benchmarks

Which benchmarks are you talking about? It depends on what those benchmarks measure.

For example, a lot of the Quantum work was in user-percieved UI latency; unless the benchmark is measuring that, and I imagine that's a hard thing to measure, it's not going to show up.

> Does Rust have a runtime penalty as Golang does?

Rust has the same amount of runtime as C does: very very little. https://github.com/rust-lang/rust/blob/master/src/libstd/rt....

Re: How Stylo Brought Rust and Servo to Firefox

#90
post #39

What parts of FF 57 are written in Rust? Just Stylo? Edit: I don't intend for this to sound like I'm complaining, just interested.

Stylo is new in Firefox 57, but Mozilla has shipped other Rust code in earlier Firefox versions: https://wiki.mozilla.org/Oxidation#Rust_components_in_Firefo... Completed: MP4 metadata parser (Firefox 48) Replace uconv with encoding-rs (Firefox 56) U2F HID backend (Firefox 57) In progress: URL parser WebM demuxer WebRender (from Servo) Audio remoting for Linux SDP parsing in WebRTC (aiming for Firefox 59) Linebreakin…

Can anyone explain what a URL parser does and why it's so complex? I feel like there's a whole interesting story lurking there.
Post reply on HN