A D vs. Rust example

Don Allen donaldcallen at gmail.com
Wed Oct 26 17:06:33 UTC 2022


On Wednesday, 26 October 2022 at 15:48:02 UTC, Ola Fosheim 
Grøstad wrote:
> On Wednesday, 26 October 2022 at 14:59:02 UTC, Don Allen wrote:
>> If you think that the user experience would be any different 
>> if Mozilla used Go or D for the work they are doing with 
>> Firefox, then you and I just need to agree to disagree.
>
> Browsers are generally written in C++? They use a dedicate GC 
> for dealing with javascript objects. The renderer for Chrome 
> called Skia is written in C++ and is gradually moving rendering 
> to the graphics co-processor.
>
> You cannot easily do these things with a run-of-the-mill GC as 
> in Go, and not at all with a freeze-the-world GC.

Opinion stated as fact. And how do you know that a 
freeze-the-world GC, if that were used, would be a browser's 
performance bottleneck, with all the network-imposed delays users 
experience when browsing? I speak from decades of 
performance-analysis experience where I found that programmers 
are horrible at guessing why their programs perform as they do. 
Which leads to the rule "Do the measurements, then we'll talk".

And how, pray tell, would the use of Go or D prevent "moving 
rendering to the graphics co-processor"? Which, of course, takes 
performance pressure off the code on running the main processor.

>
> Browsers do a lot of work in the background. A browser is 
> basically one gigantic runtime for javascript. You don't want 
> to deal with another heavy runtime at the same time. That would 
> make performance tuning very difficult.
>
> That said, I don't know how much Firefox relies on Rust. 
> Wikipedia says that Mozilla dropped Servo (the engine that was 
> being implemented in Rust).
>
>> dealing with Rust's challenges, I turned to D. The performance 
>> of the C, Rust and D versions of the most processor-intensive 
>> application are within a few percent of each other, 
>> indistinguishable in actual use.
>
> You probably didn't generate much garbage. And frankly, you can 
> easily write a well-performing basic financial application in 
> Python without paying any attention to algorithms or memory. So 
> I don't think this is a good use case for comparison.

Interesting conclusion, based on zero knowledge of what my 
application does.





More information about the Digitalmars-d mailing list