[go: up one dir, main page]

|
|
Log in / Subscribe / Register

DNF 3: better performance and a move to C++

DNF 3: better performance and a move to C++

Posted Apr 4, 2018 7:15 UTC (Wed) by cpitrat (subscriber, #116459)
In reply to: DNF 3: better performance and a move to C++ by zlynx
Parent article: DNF 3: better performance and a move to C++

That's not true, even with precompiled headers, no LTO and -O0 compiling hundreds of C++ files (5-10k sloc) usually take minutes. This even impacts the way you code (pimpl and other tricks for faster compilation). I don't know much of Go but I observed that building a project of the same size takes a few seconds.


to post comments

DNF 3: better performance and a move to C++

Posted Apr 5, 2018 15:34 UTC (Thu) by zlynx (guest, #2285) [Link] (1 responses)

I just retried my project in debug mode. 642 C++ and header files. 150,000 lines of code.

> real 0m7.059s
> user 0m14.177s
> sys 0m2.159s

Here is github.com/coreos/etcd with go build -a -v. 1,620 Go files, 538,484 lines of code.

> real 0m11.980s
> user 0m53.516s
> sys 0m4.843s

Both of those were done on a 4c/8t CPU with 8 threads.

So yes, Go builds faster. But not by a whole lot. And a build time of "minutes" is not realistic.

DNF 3: better performance and a move to C++

Posted Apr 5, 2018 17:10 UTC (Thu) by excors (subscriber, #95769) [Link]

On the other hand, something like https://www.boost.org/doc/libs/1_66_0/libs/spirit/example... takes (on my reasonable CPU) 7 seconds to compile a single small source file with g++ -O0. Spirit is absurdly bad for this, but other libraries that make heavy use of fancy templates can be pretty expensive too, and it's an aspect of library design that is often completely ignored. (https://github.com/fmtlib/fmt#benchmarks is one of the few places I've seen compile time benchmarks given the same prominence as runtime benchmarks.)

That's certainly a manageable problem (you can design libraries in ways that don't involve enormous amounts of inline template code), but it takes a bit of knowledge and discipline to make sure you avoid dependencies that significantly hurt your project's compile times.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds