News for hackers. Stuff that matters.
Re:Is Rust faster than C? by nurettin on Wednesday January 14, 2026 @10:33AM (#46617200)
Yes! gcc/omp in general solved a lot of the problems which are conveniently left out in the article.

The we have the anecdotal "They failed firefox layout in C++ twice then did it in Rust" < to this I sigh in chrome.

Re:Is Rust faster than C? by steveklabnik on Wednesday January 14, 2026 @10:39AM (#46617288)
The Rust version of this is "turn .iter() into .par_iter()."

It's also true that for both, it's not always as easy as "just make the for loop parallel." Stylo is significantly more complex than that.

> to this I sigh in chrome.

I'm actually a Chrome user. Does Chrome do what Stylo does? I didn't think it did, but I also haven't really paid attention to the internals of any browsers in the last few years.

Re:Is Rust faster than C? by pjmlp on Wednesday January 14, 2026 @10:59AM (#46617617)
And the C++ version is add std::execution::par_unseq as parameter to the ranges algorithm.
Re:Is Rust faster than C? by MeetingsBrowser on Wednesday January 14, 2026 @03:44PM (#46623019)
This has the same drawbacks as "#pragma omp for".

The hard part isn't splitting loop iterations between threads, but doing so _safely_.

Proving an arbitrary loop's iterations are split in a memory safe way is an NP hard problem in C and C++, but the default behavior in Rust.

Re:Is Rust faster than C? by pjmlp on Thursday January 15, 2026 @01:43AM (#46628927)
Well, if you are accessing global data with ranges, you are doing it wrong.

Naturally nothing on C++ prevents someone to do that, which is why PVS, Sonar and co exist.

Just like some things aren't prevented by Rust rather clippy.

Re:Is Rust faster than C? by jltsiren on Thursday January 15, 2026 @03:33AM (#46629771)
Concurrency is easy by default. The hard part is when you are trying to be clever.

You write concurrent code in Rust pretty much in the same way as you would write it in OpenMP, but with some extra syntax. Rust catches some mistakes automatically, but it also forces you to do some extra work. For example, you often have to wrap shared data in Arc when you convert single-threaded code to use multiple threads. And some common patterns are not easily available due to the limited ownership model. For example, you can't get mutable references to items in a shared container by thread id or loop iteration.

Re:Is Rust faster than C? by dwattttt on Thursday January 15, 2026 @05:42AM (#46630710)
> For example, you can't get mutable references to items in a shared container by thread id or loop iteration.

This would be a good candidate for a specialised container that internally used unsafe. Well, thread id at least; since the user of an API doesn't provide it, you could mark the API safe, since you wouldn't have to worry about incorrect inputs.

Loop iteration would be an input to the API, so you'd mark the API unsafe.

Re:Is Rust faster than C? by unrealhoang on Thursday January 15, 2026 @07:45AM (#46631655)
There’s split_at_mut to avoid writing unsafe yourself in this case.
Re:Is Rust faster than C? by nurettin on Wednesday January 14, 2026 @11:17AM (#46617897)
Afaik it does all styling and layout in the main thread and offloads drawing instructions to other threads (CompositorTileWorker) and it works fine?
Re:Is Rust faster than C? by dwattttt on Wednesday January 14, 2026 @07:43PM (#46626308)
That does sound like Chrome has also either failed to make styling multithreaded in C++ (or haven't attempted it), while it was achieved in Rust?