|
|
Subscribe / Log in / New account

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

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

Posted Mar 29, 2018 17:01 UTC (Thu) by rahulsundaram (subscriber, #21946)
In reply to: DNF 3: better performance and a move to C++ by antiphase
Parent article: DNF 3: better performance and a move to C++

> Fixing bugs is boring. Rewriting from scratch in a new language is much more interesting

Moving from C to C++ can and does fix a number of bugs, improve security and performance. Many projects including say GCC has done it for similar reasons.

> think how much benefit people will see from being able to install more packages per second.

People do benefit from faster installations and upgrades.


to post comments

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

Posted Mar 31, 2018 0:21 UTC (Sat) by Twirrim (subscriber, #122505) [Link] (1 responses)

> People do benefit from faster installations and upgrades.

I'd be really curious where shaving a few seconds off on package upgrades or installations is that advantageous. Yes speeding up yum is a nicer user experience, but this seems to be well into the territory of diminishing returns.

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

Posted Mar 31, 2018 2:16 UTC (Sat) by rahulsundaram (subscriber, #21946) [Link]

> I'd be really curious where shaving a few seconds off on package upgrades or installations is that advantageous.

Two major places atleast, initial installation and full release upgrades. Anaconda, the Fedora installer doesn't support upgrades anymore. It is all handled through the dnf system upgrade plugin and for each of these use cases, the performance differences are substantial.

There are plenty of other places including package builds in the buildsystem or QA test systems which are done in a clean chroot, where a few seconds can add up over time.

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

Posted Mar 31, 2018 17:41 UTC (Sat) by HenrikH (subscriber, #31152) [Link] (6 responses)

How does moving from C to C++ improve performance?

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

Posted Mar 31, 2018 18:07 UTC (Sat) by rahulsundaram (subscriber, #21946) [Link] (4 responses)

> How does moving from C to C++ improve performance?

It certainly can but I think you are mixing up two things. Read the announcement linked in the article. Dnf 3 includes both performance work and a move from C to C++. They are not necessarily related.

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

Posted Mar 31, 2018 18:23 UTC (Sat) by rahulsundaram (subscriber, #21946) [Link] (2 responses)

Addendum, if the question was really, can C++ improve performance over C? the answer is of course, it can

http://benchmarksgame.alioth.debian.org/u64q/cpp.html

It is not uniformally better but a lot of C programs end up duplicating parts of C++ poorly. A move to C++ can help in such circumstances.

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

Posted Apr 1, 2018 17:05 UTC (Sun) by HenrikH (subscriber, #31152) [Link] (1 responses)

Well of course C++ will be better if the C programmer badly duplicates parts of C++. I was more worried that compilers these days would produce better code in the C++ path than in the C one.

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

Posted Apr 2, 2018 13:24 UTC (Mon) by ncm (guest, #165) [Link]

It is quite routine for a C++ program to be faster than a C effort in the same space. The difference is ultimately traceable to C++ being better at encapsulating logic in libraries. The consequence is that there is a lot of power packaged in libraries now that any program can draw upon, that would simply be too much work to bother with reproducing at the call site, in C.

That power includes application of algorithms that are too finicky to code for just one use; performance tuning, likewise; and data structures, again. C has inlining now, but C++ is able to make much more effective use of it, and the optimizers understand that use, so can squeeze out what used to be called "abstraction overhead" (when there usually was some).

Furthermore: because it is easier to work with values directly in C++, rather than by reference, the optimizer has more to work with, not bothered by potential aliasing.

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

Posted Apr 1, 2018 16:58 UTC (Sun) by HenrikH (subscriber, #31152) [Link]

I'm not mixing anything up, it was a direct question to your post where you wrote "Moving from C to C++ can and does fix a number of bugs, improve security and performance.", you clearly say that moving from C to C++ can and does improve performance.

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

Posted Apr 7, 2018 9:57 UTC (Sat) by HelloWorld (guest, #56129) [Link]

Templates will generate code specialized for different types which can speed things up immensely. Try sorting a list of doubles with std::sort and qsort. The latter will be slower.

There's also a more subtle reason: C++ allows you to abstract over things that C doesn't, hence allowing better code re-use. And you're more likely to use good algorithms and data structures if somebody else built them generically and put them into an easy-to-use library than if you have to build them yourself.


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