Live data from Hacker News

Implications of Rewriting a Browser Component in Rust

hacks.mozilla.org

251–260 of 279 posts

Re: Implications of Rewriting a Browser Component in Rust

#251

Earlier quoted context omitted.

Curious about memory usage too

I think the best way to look at it is that memory usage becomes predictable and GC pause free. An application of similar scale and implementation between Java and Rust won't necessarily use less memory when in Rust.

Naively I thought Java data model was inherently more demanding than Rust but .. I never read about Rust memory layouts.

Re: Implications of Rewriting a Browser Component in Rust

#252

Earlier quoted context omitted.

I believe the performance differences on The Computer Language Benchmarks Game is largely due to the implementations themselves. For one, pidigits have been translated from Pascal to Ada using p2ada. I do not think that this is a fair comparison at all.

I agree on that one, I'm rusty at ada, bad pun, but someone should profile and fix it. The n body one is half the speed of rust and it is hand tweaked using simd instructions. I wouldn't mind at all goin back to Ada. Most of the people that switched to c++ did so in order to have a larger hiring pool or to seem more modern. Some of them are switching to safety critical Java now for the same reasons. I suspect safety…

Yeah, I wish we had Ada experts fixing and optimizing them. That would be neat! It matters a lot to people, and Rust versions have been optimized to oblivion by many people. It should be done with Ada, too, to have a fair comparison. :)

And yeah, it is a valid and very serious issue. If we had more Ada programmers, we would not have to sit in trains or airplanes "powered" by C++, haha.

Re: Implications of Rewriting a Browser Component in Rust

#253
post #244

Earlier quoted context omitted.

A crash is a bug but not a security problem.

Such affirmation requires that a crash will never produce a security problem. But for example... "Families are LOCKED OUT of or INSIDE their homes as Yale 'smart' security app crashes leaving dozens stranded" https://www.dailymail.co.uk/news/article-6268379/People-lock... "Households up and down the UK were unable to lock or unlock their doors" An unlocked door it's a security problem too...

That's still a bug. I feel like you're being intentionally obtuse about what's considered to be a security problem in code. Nobody ever suggested that rust code can never crash or have bugs. It's just about memory safety, which obviously has nothing to do with door locks.

Re: Implications of Rewriting a Browser Component in Rust

#254
post #215

Earlier quoted context omitted.

Many planes, trains, rockets and medical devices run on Ada. There is more to commercial compilers than winning the benchmarks game.

Most of my experience is embedded c++ but I have written ada rust and a fair bit of jovial73. Rust is a perfect fit for those same domains. Most o the things that ran Ada in the US have now switched to c++. Do178b certified safety critical c++ is a horrible thing to develop. I'm hoping rust comes in to fix that.

Sure, safe system programming languages should be seen as allies to the common goal of improving the quality of our IT stacks.

Re: Implications of Rewriting a Browser Component in Rust

#255

Can you build in some kind of "unsafe release" mode, so that every array bound check that were asked in the code are skipped ? If not, would it be an interesting feature ?

You could do something with rusts feature system and macros. In essence you'd have a macro that would run a different line of code if your feature is enabled versus disabled, so you could use the unbounded lookup on the array.

That said, this would be a user implementation and wouldn't be likely to be provided by the standard Library

Re: Implications of Rewriting a Browser Component in Rust

#256

Earlier quoted context omitted.

I knew you could turn off the runtime but not about the formal verification lint tools that make it safe to do so. My reference for performance is the benchmark game. If you or someone else can mod those programs to beat rust I'd be thrilled. I like Ada.

I believe the performance differences on The Computer Language Benchmarks Game is largely due to the implementations themselves. For one, pidigits have been translated from Pascal to Ada using p2ada. I do not think that this is a fair comparison at all.

The other Ada pidigits program currently fails because output checking was made more restrictive:

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

It would be great if you would contribute a program that fixes this trivial problem:

https://salsa.debian.org/benchmarksgame-team/benchmarksgame/...

Re: Implications of Rewriting a Browser Component in Rust

#257
post #244

Earlier quoted context omitted.

Such affirmation requires that a crash will never produce a security problem. But for example... "Families are LOCKED OUT of or INSIDE their homes as Yale 'smart' security app crashes leaving dozens stranded" https://www.dailymail.co.uk/news/article-6268379/People-lock... "Households up and down the UK were unable to lock or unlock their doors" An unlocked door it's a security problem too...

That's still a bug. I feel like you're being intentionally obtuse about what's considered to be a security problem in code. Nobody ever suggested that rust code can never crash or have bugs. It's just about memory safety, which obviously has nothing to do with door locks.

Sorry if I gave that impression. It was not my intention.

> A crash is a bug but not a security problem.

I think that all bugs, the ones that produces crashes and security bugs should be all treated equally. A bug is a bug, whenever it has security implications or not.

To me, the article gives the impression that a system crash is not a security problem, because a Rust program will "terminate in a controlled fashion, preventing any illegal access". But one for example, can fingerprint a system by forcing it to crash.

And of course, nobody expects that Rust will prevent bugs from happening, but at the same time I don't get why the fixation of setting a difference between security bugs and bugs.

"security problems are just bugs" - Linus Torvalds. (http://lkml.iu.edu/hypermail/linux/kernel/1711.2/01701.html)

edit: Linus reference.

Re: Implications of Rewriting a Browser Component in Rust

#258

Earlier quoted context omitted.

I believe the performance differences on The Computer Language Benchmarks Game is largely due to the implementations themselves. For one, pidigits have been translated from Pascal to Ada using p2ada. I do not think that this is a fair comparison at all.

I agree on that one, I'm rusty at ada, bad pun, but someone should profile and fix it. The n body one is half the speed of rust and it is hand tweaked using simd instructions. I wouldn't mind at all goin back to Ada. Most of the people that switched to c++ did so in order to have a larger hiring pool or to seem more modern. Some of them are switching to safety critical Java now for the same reasons. I suspect safety…

Even being rusty at Ada, you may be able to fix this regex program:

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

https://salsa.debian.org/benchmarksgame-team/benchmarksgame/...

Re: Implications of Rewriting a Browser Component in Rust

#259
post #256

Earlier quoted context omitted.

I believe the performance differences on The Computer Language Benchmarks Game is largely due to the implementations themselves. For one, pidigits have been translated from Pascal to Ada using p2ada. I do not think that this is a fair comparison at all.

The other Ada pidigits program currently fails because output checking was made more restrictive: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... It would be great if you would contribute a program that fixes this trivial problem: https://salsa.debian.org/benchmarksgame-team/benchmarksgame/...

I tested the code. It compiles and runs just fine. I compared the checksum of the output from both Rust and this version, they are identical:

md5 5b185f9a67a426baf78aa3bbb5baf8df out_rust

md5 5b185f9a67a426baf78aa3bbb5baf8df out_ada

On top of that, I got this:

Rust:

real 0m0.702s

user 0m0.693s

sys 0m0.007s

Ada:

real 0m0.708s

user 0m0.706s

sys 0m0.000s

Why don't you use this version instead? The output is correct and identical to Rust's, and the performance is significantly better: just as fast as C and Rust, as expected.

Thanks for letting us know about its existence!

Re: Implications of Rewriting a Browser Component in Rust

#260
post #256

Earlier quoted context omitted.

The other Ada pidigits program currently fails because output checking was made more restrictive: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... It would be great if you would contribute a program that fixes this trivial problem: https://salsa.debian.org/benchmarksgame-team/benchmarksgame/...

I tested the code. It compiles and runs just fine. I compared the checksum of the output from both Rust and this version, they are identical: md5 5b185f9a67a426baf78aa3bbb5baf8df out_rust md5 5b185f9a67a426baf78aa3bbb5baf8df out_ada On top of that, I got this: Rust: real 0m0.702s user 0m0.693s sys 0m0.007s Ada: real 0m0.708s user 0m0.706s sys 0m0.000s Why don't you use this version instead? The output is correct and…

> I compared the checksum

At what N?

> The output is correct

Nope. diff

    3c3
     6264338    :27

    PROGRAM OUTPUT:
    3141592653 :10
    5897932384 :20
    6264338
Post reply on HN