Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
strager
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
12 ms
·
31.
▲
by
strager
4y ago
You're welcome! But maybe my code (written by a Rust newbie) isn't the best to learn from... ;P
32.
▲
by
strager
4y ago
For the 17k SLOC project, link times were already under 100 milliseconds without mold. (EDIT: Actually linking took 129 milliseconds with GNU ld.) There are other, bigger bottlenecks to deal with. As a project grows larger, link times becom
33.
▲
by
strager
4y ago
Thank you for your kind words! I appreciate your empathy. This project took about 7 weeks (including trimming, porting, benchmarking, optimizing, and finally writing the article).
34.
▲
by
strager
4y ago
Ah, good point. I hadn't considered this.
35.
▲
by
strager
4y ago
> unsafe and passing pointers everywhere? Do you think this would impact Rust build times? > Reimplementing vectors and linked lists. Someone has to implement them. Note that they're also implemented in the C++ code, so the compa
36.
▲
by
strager
4y ago
> Note how the OP uses an M1 laptop w/64MB of ram. I tested with two different machines: * Linux machine with an AMD Ryzen 9 5950X * macOS machine with an M1 Max Each chart is labelled with 'Linux' or 'macOS'. &g
37.
▲
by
strager
4y ago
> I wonder if OP's C++ port doesn't use iterators that much, and how idiomatic it is. I think I only used iterators in places where there's no built-in function on slices like C++'s strchr and strspn. (I think Rust&#x
38.
▲
by
strager
4y ago
> the default automated Rust formating tool is very eager to adds lot of lines by basically keeping only one word per line. This is not my experience. Lifetime and '&mut self' noise (and four-space indentation) did cause ru
39.
▲
by
strager
4y ago
> If I was thinking about how to get fast builds it would force the language to change - header files would be banned and that means macros and the whole idea of preprocessing. That means a different approach to multi-platform support. I
40.
▲
by
strager
4y ago
> I think it's hard to draw absolute conclusions because small things can make a huge difference to build times. Of course. I tried my best to optimize the C++ build and the Rust build. > It's also very important to be able
41.
▲
by
strager
4y ago
Were those proc macros that you wrote, or proc macros in third-party crates?
42.
▲
by
strager
4y ago
> Sanitizers should primarily impact runtime performance anyways, but that's moot. In my experience, ASAN has a huge negative impact on build times for C++ code (Clang and GCC).
43.
▲
by
strager
4y ago
Oh, I did not know this.
44.
▲
by
strager
4y ago
The article does not account for this. I wanted the fastest build-test cycle. It sounds unfair to artificially slow down C++ compilation just because Rust has undisablable checks. EDIT: Oops, I realized I already replied two hours ago.
45.
▲
by
strager
4y ago
> This is something Rust folks should strive to solve as a differentiator, because there is no realistic way of making incremental C++ builds faster. I think C++20 modules are the promised golden ticket. It's 2023 and I still can&#x
46.
▲
by
strager
4y ago
I also benchmarked the Rust code with a monolithic crate. It built slower. https://quick-lint-js.com/blog/cpp-vs-rust-build-times/#opti...
47.
▲
by
strager
4y ago
> An interesting thought is that we really ought to not compare rust with just GCC, but GCC + clang-tidy Nitpick: The article compares Clang, not GCC. (GCC is mentioned only to show how much faster Clang is.) > you get so much more st
48.
▲
by
strager
4y ago
I'm sorry to hear that! Did you try upgrading your hardware? It really helps.
49.
▲
by
strager
4y ago
Good question! Based on my profiling, it seems like the code gen backend (LLVM) is a big offender. A code generator optimized for build times would be nice. (Cranelift seems to be a failure in that regard.) C++ has an explicit template inst
50.
▲
by
strager
4y ago
I checked how long linking takes for quick-lint-js [1] with Mold. 108 milliseconds. That's pretty chunky. I should try .so files like you suggest. [1] the full project, not the 17k SLOC subset discussed in the article
51.
▲
by
strager
4y ago
Yup! And I evaluated some different crate structures: https://quick-lint-js.com/blog/cpp-vs-rust-build-times/#opti...
52.
▲
by
strager
4y ago
> I don’t think the Rust code could be shorter than the C++ code when converting pretty much line by line, since that leads to C++-style Rust code. I thought the opposite: header files (and CMakeLists.txt, which was included in the subto
53.
▲
by
strager
4y ago
> Of course Rust is slower than C++. C++ has had decades of maturity and has enjoyed many contributors to its tooling. Rust has not, and its feature set (as in, the things the compiler needs to do) is much broader than any C++ compiler i
54.
▲
by
strager
4y ago
> I don't really like these comparisons looking at these languages through the lens of commonality. The only thing the two have in common is that they're systems languages. > > [...] In my opinion, anyone who argued about
55.
▲
by
strager
4y ago
That's a great idea! Unfortunately, I think there's no way to disable rustc's borrow checking or other safety features.
56.
▲
by
strager
4y ago
> not every C++ project is full of template metaprogramming You're right. My project is not one of those projects. As mentioned in the article, the C++ project has no dependencies (outside googletest and the standard library, whose
57.
▲
by
strager
4y ago
No. If I was going to run sanitizers with the C++ code, for a fair comparison, I would also run the Rust code with Miri. (C++ sanitizers check unsafe code, but without Miri, rustc mostly checks only safe code.)
58.
▲
by
strager
4y ago
That would imply that the input array given to qsort was misaligned. I don't think alignment is an issue in the comparator.
59.
▲
by
strager
4y ago
This happens for me with YouTube in Safari occasionally. It might be a bug with the website, not Firefox or Safari.
60.
▲
by
strager
4y ago
> Are there not corrupt politicians? There are. And democracy makes politicians seem more legitimate. Democracy in the wrong place can make corruption worse. Hiring cops should not be a popularity contest (i.e. democratic) in my opinion.
More ›