Live data from Hacker News

How Stylo Brought Rust and Servo to Firefox

bholley.net

51–60 of 199 posts

Re: How Stylo Brought Rust and Servo to Firefox

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

I think "get it right" here is "have it work at all", not "get it fast".

Ah, that makes sense!

Re: How Stylo Brought Rust and Servo to Firefox

#52
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 bringing Servo up to full web compatibility, or can this be handled through the Project Quantum process, of hiving off components from Servo into Firefox?

Re: How Stylo Brought Rust and Servo to Firefox

#53
I really like the new Fox. I’ve tried switching over completely but I think it’s causing some random BSODs on my Latitude E5570. The laptop does have a second Nvidia graphics card, for which there is no driver installed. ( don’t ask :) I’m perfectly fine with the onboard Intel and I much prefer the extra hours of battery life)

Re: How Stylo Brought Rust and Servo to Firefox

#54
post #47

> They borrowed Apple’s C++ compiler backend, which lets Rust match C++ in speed without reimplementing decades of platform-specific code generation optimizations. This was a pretty smart move by the Rust team, and this gave them a rock solid platform to go cross-platform. In words of Newton, "If I have seen further it is by standing on the shoulders of giants". Kudos team Rust, and let's hope they eat C++'s lunch so…

Does this just mean LLVM? Because it's weird to describe it as "Apple's", Apple just uses it.

Yes, this is LLVM.

Re: How Stylo Brought Rust and Servo to Firefox

#55

> Stylo was the culmination of a near-decade of R&D, a multiple-moonshot effort to build a better browser by building a better language. This is the most impressive, and useful aspect of all the recent work in Firefox. Rust is an amazing language. It really brings something new to the table with its borrow checker. The fact that rust was created as part of a greater effort to work on a web browser is amazing.

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…

Well, we could look at Go and Erlang.

Re: How Stylo Brought Rust and Servo to Firefox

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

They're not saying that C++ compilers do the best possible register allocation, they're saying that C++ compilers generate a register allocation that works and doesn't contain bugs. Technically, spilling everything to memory and loading only what you need to issue instructions is "getting it right" by this definition. No compiler strives to get the "optimal" anything in the general case, but we do expect them to strive to be "correct" in all cases. The language we use determines which properties are included in our idea of "correctness".

Re: How Stylo Brought Rust and Servo to Firefox

#57

> the breadth of the web platform is staggering. It grew organically over almost three decades, has no clear limits in scope, and has lots of tricky observables that thwart attempts to simplify. It would be great to create the html/css/javascript stack from scratch, or at least make a non-backwards-compatible version that is simpler and can perform better. HTML5 showed us that can work.

Yeah but Firefox is already struggling while supporting all the possible standards and more ("sorry our site is better view with Google IE4... ehm Google Chrome"). The whole Mozilla strategy of corroding Firefox piece by piece is actually very professional. Big backwards-incompatible transitions in technology almost always fail.

> sorry our site is better view with Google IE4... ehm Google Chrome

FWIW this is usually due to folks doing performance work in only one browser or not really testing well and slapping that label on after the fact.

Or stuff like Hangouts and Allo where they use nonstandard features.

The major things Firefox doesn't support that Chrome does are U2F (it does support it now, but flipped off, will flip on soon I think) and web components (support should be available next year I guess; this kinda stalled because of lots of spec churn and Google implementing an earlier incompatible spec early or something.)

Re: How Stylo Brought Rust and Servo to Firefox

#58
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 the biggest and most significant thing; there are some smaller bits (a media parser, and something else?) included before 57.

I'd say the change of the encoding stack to encoding-rs is pretty significant; while it's not that much code it's stuff that gets used throughout the codebase.

Re: How Stylo Brought Rust and Servo to Firefox

#59

> Stylo was the culmination of a near-decade of R&D, a multiple-moonshot effort to build a better browser by building a better language. This is the most impressive, and useful aspect of all the recent work in Firefox. Rust is an amazing language. It really brings something new to the table with its borrow checker. The fact that rust was created as part of a greater effort to work on a web browser is amazing.

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…

> I find it hard to justify developing Rust just for a web browser

"just for", our browsers are already very complex.

The browser is responsible for sandboxing and in effect taming the wild web.. and the web is not looking to become less wild :)

in the future browsers will have to prioritize CPU time between tabs seeking to mine bitcoin, crazy ad schemes, and battery power.

In terms of security, browser bugs scares me a lot more than some privilege escalation bug in the kernel. Because they can quickly be deployed widely.

Re: How Stylo Brought Rust and Servo to Firefox

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

[deleted]
Post reply on HN