Live data from Hacker News

Rust 1.24

blog.rust-lang.org

121–130 of 215 posts

Re: Rust 1.24

#121

Earlier quoted context omitted.

I don't know what this means.

It means things don't usually get better until you admit they're not as good as they can be.

The rust compiler provide huge guaranties no other provide, like for memory safety. This has a performance impact.

Re: Rust 1.24

#122
post #15

Can someone sell me on using rust over python? I am just gernerally curious as to the advantage beyond rust being compiled.

They really very different but... + Static typing (extra safety, robust refactoring, code completion etc.) + Much much faster and less memory use + Compiles to a relatively standalone binary (not as good as Go though) + No Python 2/3 nonsense to deal with - Much more complicated. You have to deal with lifetimes and borrowing and so on. It's really very difficult and we still don't know how to write some types of prog…

> No Python 2/3 nonsense to deal with

Instead you have the stable/nightly nonsense to deal with, like Clippy and Rocket only working on nightly for example.

Re: Rust 1.24

#123
post #71

Earlier quoted context omitted.

Everything you can write in Python you can write in Rust, and everything you can write in Rust you can write in Python. The main differences are found in tooling, library ecosystems, development speed and runtime overhead.

Everything you can write in Python you can write in Rust, and everything you can write in Rust you can write in Python. That really isn't true in any practically meaningful sense. 'The main difference is everything is different' is not a very strong counter-argument.

> "'The main difference is everything is different' is not a very strong counter-argument."

That wasn't my counter argument, and I can't work out what you misinterpreted about what I said to get that impression.

My point was, unlike a Dremel and a plasma cutter, Rust and Python can be used for the same tasks. As they're both Turing-complete, anything you write in one can be written in another. The differences I suggested were to highlight the relative strengths, or in other words how much work you'd need to put in to get the desired result.

To be clear, if you hadn't tried to dismiss the GP who requested information about how Python and Rust compared to each other, I wouldn't have replied.

Re: Rust 1.24

#124
post #69

Earlier quoted context omitted.

Everything you can write in Python you can write in Rust, and everything you can write in Rust you can write in Python. The main differences are found in tooling, library ecosystems, development speed and runtime overhead.

Python does'nt give you the low level control needed for.. low level stuff. And even if it can be implemented does'nt mean it will be fast enough.

If that's your impression, then I'd suggest Python is used for more than you're currently aware of. Here are two examples of Python being used for "low level stuff":

https://micropython.org/

http://www.myhdl.org/

Re: Rust 1.24

#125
post #71

Earlier quoted context omitted.

Everything you can write in Python you can write in Rust, and everything you can write in Rust you can write in Python. That really isn't true in any practically meaningful sense. 'The main difference is everything is different' is not a very strong counter-argument.

> "'The main difference is everything is different' is not a very strong counter-argument." That wasn't my counter argument, and I can't work out what you misinterpreted about what I said to get that impression. My point was, unlike a Dremel and a plasma cutter, Rust and Python can be used for the same tasks. As they're both Turing-complete, anything you write in one can be written in another. The differences I sugge…

As they're both Turing-complete

The moment you trot that out, you lose your 'but your analogy is terrible' privileges by default, however terrible my analogy is.

Re: Rust 1.24

#126
post #69

Earlier quoted context omitted.

Python does'nt give you the low level control needed for.. low level stuff. And even if it can be implemented does'nt mean it will be fast enough.

If that's your impression, then I'd suggest Python is used for more than you're currently aware of. Here are two examples of Python being used for "low level stuff": https://micropython.org/ http://www.myhdl.org/

Nothing against Python (I'm using it) , but those solutions have huge performance impact comparing C/Rust on bare-metal. Interrupt handling, GPIO operations are orders of magnitude slower in python. Take such simple board and run basic bit-banged gpio PWM. You need "beefy" Cortex-M family to get similar performance that you can get with 8/16-uC with C. Nice for hacking stuff but I would't trust my AC conditioner firmware running months without power cycle on interpreted language :) C/Rust gives you static analysis of memory usage so you can predict sw memory usage. With Python VM single bug in it can shutdown your code or eat all heap. Maybe now maybe after six months running your code. Nice hacking tools thou.

Re: Rust 1.24

#127

Earlier quoted context omitted.

> Incremental compilation! Is there some algorithm in Rust which has a necessary big-O? There were compilers in the 90s which ran a million lines per second (on much slower computers). Incremental compilation feels like working around the problem rather than solving it, and I have to imagine the complexity and maintenance is much worse. I'm sure some of the LLVM optimization passes are expensive, but those are used i…

> There were compilers in the 90s which ran a million lines per second (on much slower computers). Those compilers performed nowhere near the level of optimization that modern compilers do. > I'm sure some of the LLVM optimization passes are expensive, but those are used in clang++ too, and it's not terribly slow. clang++ is sure slow if it has to rebuild an entire codebase from scratch. The main reason that C++ comp…

> Those compilers performed nowhere near the level of optimization that modern compilers do.

I think this gets at Wirth's law a bit. Yes compilers perform lots of optimizations now, but in Rust's case it is at least partly because they need to in order to claw back the performance that the Rust gives up with its abstraction (as seen in debug builds).

I do much prefer Rust's safe abstractions to writing more direct code and hoping I get it right. I hope (and do believe) that the MIR effort will somewhat rein in the burden shunted over to LLVM, as it is super painful for some of us.

Re: Rust 1.24

#128
post #125

Earlier quoted context omitted.

> "'The main difference is everything is different' is not a very strong counter-argument." That wasn't my counter argument, and I can't work out what you misinterpreted about what I said to get that impression. My point was, unlike a Dremel and a plasma cutter, Rust and Python can be used for the same tasks. As they're both Turing-complete, anything you write in one can be written in another. The differences I sugge…

As they're both Turing-complete The moment you trot that out, you lose your 'but your analogy is terrible' privileges by default, however terrible my analogy is.

How so?

Re: Rust 1.24

#129

Earlier quoted context omitted.

How much code did the preprocessor strip out?

No idea, maybe a lot from the system headers. However, it was 20,000 lines of code that survived the preprocessor, 11,000 of which were inline or template from the project itself.

- A large fraction of compiler time is spent on code generation; how many of those lines did the compiler actually generate code for? (i.e. not unused functions or uninstantiated templates)

(And in the case of uninstantiated templates, a C++ compiler doesn't even need to type check them…)

- Did you have optimizations enabled?

Re: Rust 1.24

#130
post #55

Earlier quoted context omitted.

What's the problem with that? Do you use any of glibc's private API?

The problem is that you have to think about it at all. If you compile on a machine with a new libc, and then try to run it on a machine with an old libc, it won't work. So you end up doing what most people do, even outside of Rust, which is take the oldest CentOS box you can stand and do builds on that.

The Autopackage project had a solution for this problem years ago called apbuild. It would search for the versions of glibc symbols and use the oldest possible ones, which resulted in portable binaries. With some quick googling I found the code here: https://github.com/DeaDBeeF-Player/deadbeef-plugin-builder/t... Probably doesn't work anymore though :/

It's a bit sad that this is still unsolved, probably due to the GNU people's hatred for closed-source distribution.

Post reply on HN