Earlier quoted context omitted.
You mean Mozilla, the organization that has maintained a 6 million LOC[1] C++ codebase continuously for nearly 20 years? If they can't pull it off with C++, I don't care who can, C++ is not the right tool for the job and you can file writing such a thing in it as an esoteric programming challenge, together with template Tetris. 1. https://www.openhub.net/p/firefox/analyses/latest/languages_...
What language is the CSS engine used by Chrome or Safari written in?
Mozilla Welcomes the Rust Foundation
141–150 of 184 posts
Re: Mozilla Welcomes the Rust Foundation
#142Re: Mozilla Welcomes the Rust Foundation
#143> Mozilla used Rust to build Stylo, the CSS engine in Firefox (replacing approximately 160,000 lines of C++ with 85,000 lines of Rust). I would have loved to see two competing teams rewrite it, one in C++ and the other in Rust. Saying that the rewrite is better does nothing to say WHY it's better. Refactored code is almost always radically better, even when it's in the same language, for reasons that might be insulti…
> Refactored code is almost always radically better Sometimes it is, but it is hardly the rule. New issues will always be introduced. Also, some developers get into an endless cycle of unnecessary refactoring just to use the latest and greatest of some library or framework for no real technical reason.
But the refactor is generally done with the benefit of hindsight of all the things you would have done differently if only you'd known then what you know now.
It's like saying that the second draft or edited manuscript of a novel isn't going to be better than the initial draft. Of course it's better the second time. In theory, you fixed what was wrong with the first one and implemented new and/or improved ideas.
If your refactored code is worse than the original, I feel like you're doing something wrong.
Re: Mozilla Welcomes the Rust Foundation
#144Earlier quoted context omitted.
Two points: - how does the performance of those fare against Stylo? - the developer of Chrome is so insanely rich that only a tiny tiny fraction of their budgets in practice finance all of Firefox. Summary: Mozilla manages to make an equally good or better CSS engine with a lower budget? (I admit Google might be running the Chrome team on a shoestring but my bet is they don't as coming in a position were they can kil…
Saying Rust allowed Mozilla to achieve a better result for less money is a much softer claim than saying C++ is an unsuitable language choice for this problem, which is what I was responding to. The second is the claim I would dispute. The former may be true.
If you want to dispute the claims, do the research, otherwise it's just your opinion against the actual implementation that is shipping to millions of devices.
Re: Mozilla Welcomes the Rust Foundation
#145Re: Mozilla Welcomes the Rust Foundation
#146Earlier quoted context omitted.
Mozilla already tried re-writing the CSS engine in C++ before. They failed. C++ simply wasn't usable for writing a parallel CSS engine. "This top-down structure is ripe for parallelism; however, since styling is a complex process, it’s hard to get right. Mozilla made two previous attempts to parallelize its style system in C++, and both of them failed. But Rust’s fearless concurrency has made parallelism practical!"…
So you are telling me that a parallel CSS engine can't be usable if written in C++ but large scale particle/molecule simulators, AAA game engines and other high-fidelity simulator environments are 100% C++ codebases?
Re: Mozilla Welcomes the Rust Foundation
#147Earlier quoted context omitted.
Mozilla already tried re-writing the CSS engine in C++ before. They failed. C++ simply wasn't usable for writing a parallel CSS engine. "This top-down structure is ripe for parallelism; however, since styling is a complex process, it’s hard to get right. Mozilla made two previous attempts to parallelize its style system in C++, and both of them failed. But Rust’s fearless concurrency has made parallelism practical!"…
> C++ simply wasn't usable for writing a parallel CSS engine. I think it can be said that Mozilla was able to use Rust to achieve what they failed to with achieve with C++. It's not justified to claim that C++ is/was not suitable for this purpose. C++ offers direct, low-level control over memory, and C++ can be used to implement anything which can be implemented in Rust. Maybe Rust has certain advantages which made t…
Re: Mozilla Welcomes the Rust Foundation
#148Earlier quoted context omitted.
> C++ offers direct, low-level control over memory, and C++ can be used to implement anything which can be implemented in Rust. Maybe Rust has certain advantages which made this problem a lot easier to solve for Mozilla, and I'm certainly happy to have Rust in the language landscape, but another team with other processes may have been able to use C++ to achieve similar goals. You could say the same thing about assemb…
> You could say the same thing about assembly programming or some language that uses GOTOs instead of structured control constructs ... or Brainfuck. I think this a reduction of the argument to the point of absurdity. C++ and Rust are certainly much more similar in terms of form and capability than C++ and brainfuck. > Claims about this or that language being unsuitable for a problem aren't really about stuff like Tu…
I know very little about rust, so take this with a grain of salt. It's possible that writing the CSS engine in C++ would require too many custom classes, containers, and build tools outside of the STL than equivalent code in Rust. For example, fast mutexes and mutex safety are not a standard part of C++ but vital to fast parallel C++ code, and the semantics of mutexes are thus very hard to get right. Static checkers for specific mutex implementations can decrease the risk of deadlocks and races but these are additions to C++. If rust provides primitive mutexes with static checking for correctness or other language features (maybe refcell or similar) then it might be worth using rust to stay within the standard language features instead of building add-ons for C++.
Re: Mozilla Welcomes the Rust Foundation
#149Earlier quoted context omitted.
> C++ simply wasn't usable for writing a parallel CSS engine. I think it can be said that Mozilla was able to use Rust to achieve what they failed to with achieve with C++. It's not justified to claim that C++ is/was not suitable for this purpose. C++ offers direct, low-level control over memory, and C++ can be used to implement anything which can be implemented in Rust. Maybe Rust has certain advantages which made t…
The biggest advantage of Rust is that the liner types and the borrow checker forces one to structure the application in a way that is much more manageable long-term and less error-prone even with occasional sprinkle of unsafe code. Surely one can code in such style in C++, but it is very unnatural there with a lot of boilerplate, so one just would not consider it typically.
Re: Mozilla Welcomes the Rust Foundation
#150Earlier quoted context omitted.
Mozilla already tried re-writing the CSS engine in C++ before. They failed. C++ simply wasn't usable for writing a parallel CSS engine. "This top-down structure is ripe for parallelism; however, since styling is a complex process, it’s hard to get right. Mozilla made two previous attempts to parallelize its style system in C++, and both of them failed. But Rust’s fearless concurrency has made parallelism practical!"…
> Mozilla already tried re-writing the CSS engine in C++ before. They failed Blaming the tool for own failure to do the job isn't all that persuasive. > C++ simply wasn't usable for writing a parallel CSS engine. It might be not so much the proof of C++ deficiency as simply another manifestation of mismanagement of the browser development by Mozilla Foundation. > But Rust’s fearless concurrency has made parallelism p…
I would argue it is persuasive if switching to a new tool lead to success. What would be the point of continuing to try the thing that's not working?