Most active commenters
  • GuB-42(4)
  • adastra22(3)
  • izacus(3)
  • frollogaston(3)
  • pjmlp(3)

←back to thread

302 points Bogdanp | 31 comments | | HN request time: 2.24s | source | bottom
1. adastra22 ◴[] No.44390813[source]
As a former C++ developer, claims that rust compilation is slow leave me scratching my head.
replies(5): >>44390867 #>>44390918 #>>44391177 #>>44395299 #>>44403069 #
2. shadowgovt ◴[] No.44390867[source]
I thorougly enjoy all the work on encapsulation and reducing the steps of compilation to compile, then link that C does... Only to have C++ come along and undo almost all of it through the simple expedient of requiring templates for everything.

Oops, changed one template in one header. And that impacts.... 98% of my code.

3. eikenberry ◴[] No.44390918[source]
Which is one of the reasons why Rust is considered to be targeting C++'s developers. C++ devs already have the Stockholm syndrome needed to tolerate the tooling.
replies(3): >>44391267 #>>44391775 #>>44392740 #
4. MobiusHorizons ◴[] No.44391177[source]
Things can still be slow in absolute terms without being as slow as C++. The issues with compiling C++ are incredibly well understood and documented. It is one of the worst languages on earth for compile times. Rust doesn’t share those language level issues, so the expectations are understandably higher.
replies(3): >>44392236 #>>44392850 #>>44403086 #
5. MyOutfitIsVague ◴[] No.44391267[source]
Rust's compilation is slow, but the tooling is just about the best that any programming language has.
replies(2): >>44392557 #>>44394703 #
6. zozbot234 ◴[] No.44391775[source]
> Stockholm syndrome

A.k.a. "Remember the Vasa!" https://news.ycombinator.com/item?id=17172057

7. int_19h ◴[] No.44392236[source]
But it does share some of those issues. Specifically, while Rust generics aren't as unstructured as C++ templates, the main burden is actually from compiling all those tiny instantiations, and Rust monomorphization has the same exact problem responsible for the bulk of its compile times.
8. GuB-42 ◴[] No.44392557{3}[source]
How good is the debugger? "edit and continue"? Hot reload? Full IDE?

I don't know enough Rust, but I find these aspects are seriously lacking in C++ on Linux, and it is one of the few things I think Windows has it better for developers. Is Rust better?

replies(3): >>44392771 #>>44393092 #>>44393361 #
9. galangalalgol ◴[] No.44392740[source]
Also modern c++ with value semantics is more functional than many other languages people might come to rust from, that keeps the borrow checker from being as annoying. If people are used to making webs of stateful classes with references to each pther. The borrow checker is horrific, but that is because that design pattern is horrific if you multithread it.
10. adastra22 ◴[] No.44392771{4}[source]
No idea because I never do that. Nor does any rust programmer I know. Which may answer your question ;)
replies(2): >>44398467 #>>44401430 #
11. const_cast ◴[] No.44392850[source]
Rust shares pretty much every language-level issue C++ has with compile times, no? Monomorphization explosion, turing-complete compile time macros, complex type system.
replies(1): >>44393362 #
12. mdaniel ◴[] No.44393092{4}[source]
> How good is the debugger? "edit and continue"?

Relevant: Subsecond: A runtime hotpatching engine for Rust hot-reloading - https://news.ycombinator.com/item?id=44369642 - June, 2024 (36 comments)

> Full IDE?

https://www.jetbrains.com/rust/ (newly free for non-commercial use)

> find these aspects are seriously lacking in C++ on Linux

https://www.jetbrains.com/clion/ (same, non-commercial)

13. steveklabnik ◴[] No.44393361{4}[source]
> debugger

I've only ever really used a debugger on embedded, we used gdb there. I know VS: Code has a debugger that works, I'm sure other IDEs do too.

> edit and continue

Hard to do in a pre-compiled language with no runtime, if you're asking about what I think you're asking about.

> Hot reload

Other folks gave you good links, but this stuff is pretty new, so I wouldn't claim that this is great and often good and such.

> Full IDE

I'm not aware of Rust-specific IDEs, but many IDEs have good support for Rust. VS: Code is the most popular amongst users according to the annual survey. The Rust Project distributes an official LSP server, so you can use that with any editor that supports it.

replies(2): >>44394920 #>>44403078 #
14. steveklabnik ◴[] No.44393362{3}[source]
There's a lot of overlap, but not that simple. Unless you also discount C issues that C++ inherits. Even then, there's subtleties and differences between the two that matter.
15. adastra22 ◴[] No.44394703{3}[source]
Slow compared to what? I’m still scraping my head at this. My cargo builds are insanely fast, never taking more than a minute or two even on large projects. The only ahead of time compiled language I’ve used with faster compilation speed is Go, and that is a language specifically designed around (and arguably crippled by) the requirement for fast compilation. Rust is comparable to C compilation, and definitely faster than C++, Haskell, Java, Fortran, Algol, and Common Lisp.
replies(3): >>44394786 #>>44400126 #>>44407046 #
16. ◴[] No.44394786{4}[source]
17. izacus ◴[] No.44394920{5}[source]
So the answer is very clear "no" on all accounts, just like for other languages built by people who don't understand the value of good tooling.
replies(1): >>44398421 #
18. oreally ◴[] No.44395299[source]
Classic case of:

New features: yes

Talking to users and fixing actual problems: lolno, I CBF

19. frollogaston ◴[] No.44398421{6}[source]
I haven't used Rust much, but the tooling felt very solid. There's a default package manager that works well, unlike many other languages including C++ and somehow Python. Debugging is fine. Idk why you expected edit-and-continue, it's not like you get that in C++ either.
replies(2): >>44401239 #>>44402447 #
20. frollogaston ◴[] No.44398467{5}[source]
"Rust devs don't use debuggers" isn't a good answer. The one time I used Rust for some project like 7 years ago, I did have to use a debugger, and it was fine.
21. johnisgood ◴[] No.44400126{4}[source]
Just a few days ago I used cargo to install something. It took like two minutes at the last stage. Definitely not comparable to C or Fortran. I never had to wait that much before. With C++? Definitely. Never with C though.
22. GuB-42 ◴[] No.44401239{7}[source]
You have "edit and continue" in Visual Studio (the real IDE, not VS Code).

And I mentioned it as a downside of C++ on Linux, and I would expect a language that has "the best" tooling to have that.

C++ tooling isn't that great, but it has one thing going for it: it is popular in the video game industry, and the video industry has some of the best tools.

And sure enough, if by tooling you mean "package management", I'd say everything is better than C++, and on the other side, it seems that cargo is pretty good. I don't know how they tackle the "left-pad" problem that plagues npm though. By that I mean supply-chain attacks.

replies(2): >>44401312 #>>44402443 #
23. frollogaston ◴[] No.44401312{8}[source]
It's not like npm is particularly bad at handling supply-chain attacks, it's just a very popular ecosystem and gets targeted more as a result. Idk how you truly solve this without code audits, and if anything the more popular/visible packages will be audited more.

Btw, left-pad fallout wasn't all that bad. It's not like the author put something malicious into the code. For less than a day, people couldn't download that dep from npm. If someone really needed to fix a build, they could copy in a backup. Pretty sure a typical C++ or Python project build gets broken on its own more often than that.

replies(1): >>44401513 #
24. GuB-42 ◴[] No.44401430{5}[source]
If programmers don't use a debugger, that's because the debugger is bad.

For me, the ideal debugger is one you never leave. That is you are in a debugging session, maybe with your code running, or stopped on a breakpoint, and you write your code without leaving the session. You can see the values of your variables as you type them, the branches that will be taken, etc... When an error condition happen, you break on it, and still without leaving the session, you can fix the code, roll back before the error happened and see if it passes. IntelliJ is close to that, and it seems like some tools from the video game industry are even better.

Debugging should be natural, it shouldn't be something you pull out as a last resort. If it is not natural, it is a bad debugger, or a bad development environment, period. Maybe there are reasons for why it is bad, maybe the language designers have other priorities, which is acceptable, but it doesn't change the fact that it is bad. Same goes for slow compile times by the way.

25. GuB-42 ◴[] No.44401513{9}[source]
> Idk how you truly solve this without code audits

Idk either, but code audits are definitely a solution. Take Debian packages for instance. Debian has package maintainers, and while they may no do full audits, they will at least test it before publishing. In addition, it doesn't get in the "stable" release before an extensive testing phase. Security patches are usually backported.

Or do like with the Apple App Store, where you don't get to publish anything unreviewed.

These are not perfect solution, there is no such thing as a perfect solution. For instance, Debian is famously lagging behind in versions, and the App Store will sometimes reject your app for no good reason, while being expensive. In every case there is some barrier to entry, a slow process, and it costs time and money, but that mitigates some of the issues.

Npm seems to have very little safeguards, has a culture of always taking the latest version, and as a result is often victim to supply-chain attacks. I don't think it is just popularity. Debian is really popular too, but AFAIK, it doesn't have this problem, in fact, one of the best known supply-chain attack is the xz library, and Debian didn't fall to it.

26. izacus ◴[] No.44402443{8}[source]
Cargo tackles none of that, it has the exact same issue of pulling in hundreds of deps like npm has.
27. izacus ◴[] No.44402447{7}[source]
Package manager isn't all of the tooling a language needs when its used to write software.
28. pjmlp ◴[] No.44403069[source]
Not sure about you, but traditionally my C++ have always been faster than out of the box experience with Rust.

Thanks to pre-compiled headers, incremental compiler, incremental linker, and using binary libraries for all dependencies. Nowadays modules as well.

Rust compiles from scratch, some crates might get compiled multiple times due to conflicting configurations on the dependency graph, binary libraries require additional setup for something like scache.

29. pjmlp ◴[] No.44403078{5}[source]
Might be hard, but C++ ecosystem has such tooling.
30. pjmlp ◴[] No.44403086[source]
And easily solved with incremental compilers, incremental linkers, external templates and nowadays modules.
31. eikenberry ◴[] No.44407046{4}[source]
In addition to Go, off the top of my head, you have D, V-lang, Zig, Lua and every interpreted language (including Haskell and Common Lisp, as they both have interpreters). Traditional compiled languages always had terrible UX in this regard which, IMO, is why interpreted languages like Python and Ruby got so popular.