Live data from Hacker News

Show HN: I built a Cargo-like build tool for C/C++

github.com

151–160 of 181 posts

Re: Show HN: I built a Cargo-like build tool for C/C++

#151

Earlier quoted context omitted.

The only time I used -march=native was for a university assignment which was built and evaluated on the same server, and it allowed juicing an extra bit of performance. Using it basically means locking the program to the current CPU only. However I'm not sure about -O3. I know it can make the binary larger, not sure about other downsides.

If you have a lot of "data plane" code or other looping over data, you can see a big gain from -O3 because of more aggressive unrolling and vectorization (HPC people use -O3 quite a lot). CRUD-like applications and other things that are branchy and heavy on control flow will often see a mild performance regression from use of -O3 compared to -O2 because of more frequent frequency hits due to AVX instructions and larg…

I made a program with some inline assembly and tried O3 with clang once. Because the assembly was in a loop, the compiler probably didn't have enough information on the actual code and decided to fully unroll all 16 iterations, making performance drop by 25% because the cache locality was completely destroyed. What I'm trying to say, is that loop unrolling is definitely not a guarantee for faster code in exchange for binary size

Re: Show HN: I built a Cargo-like build tool for C/C++

#153
post #73
post #69

Earlier quoted context omitted.

> -march=native is always always a mistake Gentoo user : hold my beer.

Gentoo binaries aren't shipped that way

They are shipped to a new system when you upgrade because reinstalling is for suckers.

Re: Show HN: I built a Cargo-like build tool for C/C++

#154
post #99

Earlier quoted context omitted.

Yes https://wiki.gentoo.org/wiki/Gentoo_Binary_Host_Quickstart

But not with march=native? The distirbuted binaries use two standard instruction sets for x86-64 and one for arm like “march=x86-64-v3” https://wiki.gentoo.org/wiki/Gentoo_binhost/Available_packag...

You can have your own binary host or even just compile packages on another host on demand. -march=native is a concern in both cases.

Re: Show HN: I built a Cargo-like build tool for C/C++

#156
post #13
post #10

The installation instructions being a `curl | sh` writing to the user's bashrc does not inspire confidence.

They did say it was inspired by cargo, which is often installed using rustup as such: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Sure but being inspired by something doesn't mean you have to cargo cult the worst aspects of it.

Re: Show HN: I built a Cargo-like build tool for C/C++

#157
post #16
post #12

Earlier quoted context omitted.

[flagged]

If you'd just left off "to fuck" you'd end up way less downvoted, if it even happened at all.

Probably not. This isn't prime time TV, some foul language is tolerated - but complaining about down-votes, especially preemptively, has a predictable response (IMO rightfully so).

Re: Show HN: I built a Cargo-like build tool for C/C++

#158
post #37

Earlier quoted context omitted.

Do your Makefiles work across Linux, macOS and Windows (without WSL or MingW), GCC, Clang and MSVC, or allow loading the project into an IDE like Xcode or Visual Studio though? That's why meta-build-systems like cmake were created, not to be a better GNU Make.

There is something fundamentally wrong with Windows or Visual Studio that it requires ugly solutions.

At least you can use the compiler/linker without them.

Re: Show HN: I built a Cargo-like build tool for C/C++

#159
post #37

Earlier quoted context omitted.

There is something fundamentally wrong with Windows or Visual Studio that it requires ugly solutions.

Ok, then just cl.exe instead of gcc or clang. Completely different set of command line options from gcc and clang, but that's fine. C/C++ build tooling needs to be able to deal with different toolchains. The diversity of C/C++ toolchains is a strength, not a weakness :) One nice feature of MSVC is that you can describe the linker dependencies in the source files (via #pragma comment(lib, ...)), this enables building…

> Completely different set of command line options from gcc and clang, but that's fine.

Clang does have clang-cl with similar command-line options.

Post reply on HN