LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-27-2024, 12:50 PM   #16
EdGr
Senior Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 1,038

Original Poster
Rep: Reputation: 485Reputation: 485Reputation: 485Reputation: 485Reputation: 485

I was citing kicad as an example. I switched my programs to Meson and Ninja a few years ago.

Here is what I have found:

-ftime-report tells me that "phase opt and generate" and "callgraph functions expansion" are taking disproportionately long on large files.

g++ and clang++ are within 20% of each other on compilation times, and within 10% of each other on run times. I suspect that both projects benchmark themselves against the other.

The compilation time difference between -O1 and -O3 is about 2x.

A build script needed little less serialization (15% improvement).
Ed
 
Old 10-28-2024, 03:57 AM   #17
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,009

Rep: Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627
Quote:
Originally Posted by EdGr View Post
I was citing kicad as an example. I switched my programs to Meson and Ninja a few years ago.

Here is what I have found:

-ftime-report tells me that "phase opt and generate" and "callgraph functions expansion" are taking disproportionately long on large files.

g++ and clang++ are within 20% of each other on compilation times, and within 10% of each other on run times. I suspect that both projects benchmark themselves against the other.

The compilation time difference between -O1 and -O3 is about 2x.

A build script needed little less serialization (15% improvement).
Ed
It is still nonsense. You need to check more than one software, not only kicad.
-O is the optimization, the time difference again is not 2x, but depends on the code itself. Some codes can be better optimized, some others cannot.
What is the goal of this rash generalization?

Last edited by pan64; 10-28-2024 at 10:13 AM.
 
Old 10-28-2024, 09:14 AM   #18
EdGr
Senior Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 1,038

Original Poster
Rep: Reputation: 485Reputation: 485Reputation: 485Reputation: 485Reputation: 485
pan64 - You are on my ignore list.

I came up with a workaround.

Normally, when shared libraries are built and installed, all dependent programs need to be rebuilt.

However, in the special case of the library headers not being changed, the rebuild of dependent programs can be omitted. This is often true for the edit-compile-run cycle on libraries.
Ed
 
Old 10-28-2024, 10:25 AM   #19
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,009

Rep: Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627Reputation: 7627
Quote:
Originally Posted by EdGr View Post
pan64 - You are on my ignore list.
It is your problem, not mine.
Quote:
Originally Posted by EdGr View Post
I came up with a workaround.
Workaround for what?
Quote:
Originally Posted by EdGr View Post
Normally, when shared libraries are built and installed, all dependent programs need to be rebuilt.

However, in the special case of the library headers not being changed, the rebuild of dependent programs can be omitted. This is often true for the edit-compile-run cycle on libraries.
Ed
This is how c/c++ works. We have internal headers and external headers (sometimes called interfaces). If those interfaces are changed all the dependent apps should be recompiled. These are usually functional changes. If they remain intact the shared object can be replaced without any issue. These are usually bug fixes. Build systems can handle both cases automatically.
 
Old 11-06-2024, 06:13 PM   #20
notzed
Member
 
Registered: Dec 2020
Location: South Australia
Distribution: slackware64-current
Posts: 97

Rep: Reputation: Disabled
Looks about right to me. I have a gentoo machine so end up compiling a lot of C++ applications and libraries and they take considerably longer than any C ones, the only thing worse is anything rust. It just takes orders of magnitude more cpu cycles and memory compared to C to compile, that's a simple fact.

C++ despite it's name and some shared syntax is a completely different language to C - it's not even a very good super-set, it's trivial to create simple valid C programmes that aren't C++ (the 'extern "c"' thing just sets the ABI). Toy examples that are only using the C-like part of the language are not representative of the features of C++ that are used exhaustively by C++ programmers. Just look at how much longer and (much) more memory gcc itself took to compile after they moved the codebase to C++, and that uses C++ features quite frugally for exactly this reason.

The biggest culprit is templates, defining them and parsing them is a messy big task, resolving them up is a big search task, expanding them is a big task, tracking them (for debug or symbols) is a huge task. Even optimisation passes become slower (albeit potentially more effective) simply because there's more code and context to optimise. C has a bad enough problem compared to some other languages (e.g. Java, python) of header files needing to be compiled and recompiled many times in a given application, C++ only makes this problem considerably worse. And all of the complex and the obscure features encourage otherwise smart people to waste so much of their time on perfecting rather than producing, only magnified by the slow compilation times.

Can't stand it myself and think it's a pretty poor language[1], but fortunately in 25 years of being a Computer Systems Engineer I've barely had to touch it other than compiling applications and interfacing to some libraries.

[1] https://en.wikipedia.org/wiki/Criticism_of_C%2B%2B
 
1 members found this post helpful.
Old 11-07-2024, 02:53 AM   #21
EdGr
Senior Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 1,038

Original Poster
Rep: Reputation: 485Reputation: 485Reputation: 485Reputation: 485Reputation: 485
notzed - It is good to hear from someone with similar experience.

I prefer C++ because well-written C++ code is clearer and more robust than C. However, poorly-written C++ can take the obfuscated code contest to the next level. C++ features must be used selectively.

I looked into ccache as another way to speed up compilation. It addresses the problem that generated headers trigger rebuilds even if nothing had changed. I think that manually building the packages being debugged is the right amount of workaround.
Ed
 
Old 11-07-2024, 08:32 PM   #22
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,933
Blog Entries: 4

Rep: Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018
Perhaps diverting this conversation, but – the "C++" language has "evolved considerably" over these many years, and not necessarily in a "good" way.

The "templates" system is unfortunately a prime example. In my view, "the farther away 'the source-code directly in front of you' strays away from 'what is ultimately going to happen' – and your certainty of what that will be – the more the language fails to serve your actual needs. You shouldn't be questioning nor fighting against your tool, no matter how "kewel" somebody somewhere thought that the new "fee-chur" would be. The "C++" language today is anything but "stable" between one language-release to the next. And, today, I would hate to be forced to be a "compiler implementor."

When I write in the language today, I very purposely avoid as many "modern-day 'fee-churs'" as possible. And yet, I still get work done. My mantra is that stuff should be: "stupid simple." (Because: much of the source-code that I myself wrote is, today, "the work of a complete stranger." Only my "copious comments" enable me to understand it.)

Long ago someone actually constructed a "programming language" called (I think ...) WADUZITDO? (Oh, wait: it still has a website!!) Well, I simply think that, whenever someone looks at a piece of production source-code, they should never have to ask themselves that question. Unfortunately, I opine that they very often do.

Last edited by sundialsvcs; 11-07-2024 at 08:42 PM.
 
Old Yesterday, 10:00 AM   #23
EdGr
Senior Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 1,038

Original Poster
Rep: Reputation: 485Reputation: 485Reputation: 485Reputation: 485Reputation: 485
We have talked about C++'s feature creep.

I use C++98 because code does not rewrite itself, and tracking language revisions is not on my list of important problems to solve.
Ed
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Simple Java loop runs 6 times slower on Ubuntu 11.10 than Windows Vista ags1 Programming 4 05-03-2012 01:39 AM
Performance Issue the dd command says one server is three times more slower than th crazy_c2guy Linux - Server 1 10-28-2009 08:29 AM
FC6 gets slower and slower and slower... jonrpick Linux - Software 19 11-12-2007 04:02 PM
Internet speed is 50 times slower on Linux than on Windows callum85 Linux - Networking 2 10-05-2006 03:02 PM
Internet 10 times slower in linux than in windows samx123 Linux - Wireless Networking 5 03-08-2004 05:08 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration