|
|
Subscribe / Log in / New account

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

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

Posted Apr 2, 2018 13:24 UTC (Mon) by ncm (guest, #165)
In reply to: DNF 3: better performance and a move to C++ by HenrikH
Parent article: DNF 3: better performance and a move to C++

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.


to post comments


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