Is Compiling UNIX Software on OS X painfully slow compared to on a PC?

Message Bookmarked
Bookmark Removed
I'm compiling some vanilla C packages and it seems like they're taking forever compared to how long stuff used to take on my 800mhz Linux box.... What gives?

absolutego (ex machina), Sunday, 3 April 2005 21:16 (twenty-one years ago)

Don't see why it should be - are you using different optimisation settings?

caitlin (caitlin), Sunday, 3 April 2005 21:21 (twenty-one years ago)

I'm using the default makefile settings. I know that GCC internals have been given more through optimizations on x86 and Apple has contributed a ton of changes to GCC....

absolutego (ex machina), Sunday, 3 April 2005 21:23 (twenty-one years ago)

The other thing that springs to mind is: if the system header files on OS X are much more complex, it could end up making a noticeable difference to the compilation time.

caitlin (caitlin), Sunday, 3 April 2005 21:25 (twenty-one years ago)

I'm building modules with CPAN now... we'll see how this goes.

xpost

I can't imagine that header files take up that much of the compile time..... I'd imagine that most of the time is spent doing optimizations: reordering, register renaming, optimizing of caller/callee save registers for fxns that don't use some of them, unrolling loops, inlining, etc.

absolutego (ex machina), Sunday, 3 April 2005 21:27 (twenty-one years ago)

What's vmstat think? Are you just io-bound? Are you paging much?

shieldforyoureyes, Sunday, 3 April 2005 21:29 (twenty-one years ago)

It depends what you're compiling, and what it includes. With, say, Gnome programs, for example, the header files really do increase the compilation time by an enormous amount, and you can improve the situation a lot by only including the parts each file actually needs.

(xpost)

caitlin (caitlin), Sunday, 3 April 2005 21:32 (twenty-one years ago)

PCs have always been fastest in my experience. I used to compile programs on AIX, Solaris, SunOS, HP/UX, OSF/Digital Unix and Windows all on their own hardware, and it was always on the PC that it went fastest, even with the state of the art (at hte time) 500 MHz DEC Alpha took longer to compile than my 200MHz PC. Can't really tell you why, but it's always been the case. The Alpha's disk used to sound like it was going to melt when it was linking.

KeefW (kmw), Sunday, 3 April 2005 21:35 (twenty-one years ago)

Dave, uhhh I don't know how to do that on OS X... I'm not paging at all though.

Shouldn't GCC cache the generated header file if the preprocessor symbols used in it are the same as the previous instance of parsing it?

absolutego (ex machina), Sunday, 3 April 2005 21:36 (twenty-one years ago)

Do uniprocessor machines employ relaxed memory consitency models? If so it stands to reason that there is a nontrivial amount of work needed to be done to determine where to insert the memory barrier instructions on Alphas or PPC. (uhhh I think thats what both use for this....)

Or I might be totally off my rocker.

absolutego (ex machina), Sunday, 3 April 2005 21:38 (twenty-one years ago)

As far as I'm aware, only the newest experimental GCC versions do any level of header caching.

caitlin (caitlin), Sunday, 3 April 2005 21:41 (twenty-one years ago)

I should add that the compilers were different... Gcc on the Unix machines and MSDEV on the PCs.

I'd have thought GCC would always have had the latest shiny bells and whistles, but it doesn't seem to be the case. I wonder why. MS compilers have used precompiled headers for about a decade.

KeefW (kmw), Sunday, 3 April 2005 21:43 (twenty-one years ago)

I like the fact that modern languages compile to machine-independent code and do dynamic linking so compiling takes no time at all. Eclipse is sweet, it compiles the lot when you save.

KeefW (kmw), Sunday, 3 April 2005 21:45 (twenty-one years ago)

I like the fact that modern languages compile to machine-independent code and do dynamic linking so compiling takes no time at all. Eclipse is sweet, it compiles the lot when you save.

-- KeefW (m...) (webmail), April 3rd, 2005 5:45 PM. (kmw) (later) (link)

Yes, but what if we care about the start up time of our applications?

absolutego (ex machina), Sunday, 3 April 2005 21:47 (twenty-one years ago)

Which part of the above makes you application take longer to start? Dynamic linking should help... I assume you are referring to just-in-time compilation. These things can be as fast as is not noticable. Java apps can take a while, for whatever reason, but .NET apps using the same principles are, from a user's point of view, identical to their win32 relations.

KeefW (kmw), Sunday, 3 April 2005 21:50 (twenty-one years ago)

Loading libraries.

absolutego (ex machina), Sunday, 3 April 2005 21:52 (twenty-one years ago)

GCC has generally been a matter of "now you *can* compile" rather than
being competative with commercial compilers.

shieldforyoureyes, Sunday, 3 April 2005 21:52 (twenty-one years ago)

update_prebinding tries to synchronize prebinding information for
libraries and executables when new files are added to a system. Prebind-
ing information is pre-calculated address information for libraries used
by a given executable or library. By pre-determining where a function in
another library is destined to be placed, the dynamic linker does not
have to resolve symbols at application startup time, and the application
can launch faster.

Because each recompilation of a library or executable may place functions
at different addresses, a newly installed library or executable's pre-
binding information might not match the libraries already on the disk.
When the dynamic linker determines that prebinding information for a
library could be invalid, it defaults to resolving all the names for that
library, and for all libraries referenced by that library, losing any
advantage of having the prebinding information.

update_prebinding ensures that prebinding information is up-to-date after
new prebound applications or new versions of system libraries are
installed. Given a list of the newly installed files in a package,
update_prebinding finds all the libraries and executables that may dynam-
ically load the changed files. If so, the prebinding information must be
updated, and update_prebinding performs redo_prebinding to update that
file. update_prebinding builds a dependency graph to minimize the files
that must be updated, and applies a few other heuristics to only call
redo_prebinding when necessary.

absolutego (ex machina), Sunday, 3 April 2005 21:53 (twenty-one years ago)

I don't follow. If you want you application to start more quickly, surely you defer the loading of libraries until the last minute, rather than the traditional, statically-linked approach where everything is loaded into memory at startup, taking longer.

I think that's roughly what the thing you've just posted says.

KeefW (kmw), Sunday, 3 April 2005 21:55 (twenty-one years ago)

uhh, you have to look up the addresses of functions using a symbol table rather than having them statically placed in the code.

that program updates this information to avoid the lookups

absolutego (ex machina), Sunday, 3 April 2005 21:58 (twenty-one years ago)

But if you're using a dynamic type system like C++ or Java, calling an overridden method on an subclassed object requires you to look up which implementation of the fxn is used at call time... with some caching... etc

absolutego (ex machina), Sunday, 3 April 2005 21:59 (twenty-one years ago)

What I want is dynamic libraries that don't complain about a missing
library untill you try to actually execute code from it. ie: I don't
want to install 20,000 libraries that I don't want just to run the
Linux-retard version of "cat".

shieldforyoureyes, Sunday, 3 April 2005 21:59 (twenty-one years ago)

That does sound like a case of over-optimisation to me... I mean it's a simple sum... Unless you're making out-of-process calls, which is a different ball game entirely. Virtual function lookups really make little difference, unless the amount of work done in the function is so small as to be comparable with a simple vtable lookup. They're default in Java, but nonvirtual calls are default in C++/C#/VB etc.

Anyway, on another subject have any of you sysadmin types got any experience of Citrix for delivering Windows apps from a server? If so, how has it been?

KeefW (kmw), Sunday, 3 April 2005 22:02 (twenty-one years ago)

Isn't "cat" a (bas)sh-builtin usually?

absolutego (ex machina), Sunday, 3 April 2005 22:06 (twenty-one years ago)

gah, PerlMagick is such a pain to install on OS X! Does anyone know offhand how to change the GCC #include <> path? I need to add /opt/local/include

absolutego (ex machina), Sunday, 3 April 2005 22:09 (twenty-one years ago)

http://search.cpan.org/~tonyc/Imager-0.44/Imager.pm

Solution....

absolutego (ex machina), Sunday, 3 April 2005 22:14 (twenty-one years ago)

bash cat - no. Builtins are generally things that do a goofily small
amount of actual work - echo, true, etc.

shieldforyoureyes, Sunday, 3 April 2005 22:20 (twenty-one years ago)

Does anyone know offhand how to change the GCC #include path?

The -I option. Add -I/opt/local/include to the command line.

caitlin (caitlin), Monday, 4 April 2005 10:04 (twenty-one years ago)

I meant globally so I don't have to edit every makefile

absolutego (ex machina), Monday, 4 April 2005 13:53 (twenty-one years ago)

man gcc (and then scroll down several hundred pages!)

Some additional environments variables affect the behavior of the pre-
processor.

CPATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
OBJC_INCLUDE_PATH
Each variable's value is a list of directories separated by a spe-
cial character, much like PATH, in which to look for header files.
The special character, "PATH_SEPARATOR", is target-dependent and
determined at GCC build time. For Windows-based targets it is a
semicolon, and for almost all other targets it is a colon.

CPATH specifies a list of directories to be searched as if speci-
fied with -I, but after any paths given with -I options on the
command line. This environment variable is used regardless of
which language is being preprocessed.

The remaining environment variables apply only when preprocessing
the particular language indicated. Each specifies a list of
directories to be searched as if specified with -isystem, but
after any paths given with -isystem options on the command line.

In all these variables, an empty element instructs the compiler to
search its current working directory. Empty elements can appear
at the beginning or end of a path. For instance, if the value of
CPATH is ":/special/include", that has the same effect as
-I. -I/special/include.

koogs (koogs), Monday, 4 April 2005 14:30 (twenty-one years ago)

Dude, you should have just let him RTFM.

Mr Noodles (Mr Noodles), Monday, 4 April 2005 14:33 (twenty-one years ago)

that is somewhat helpful, but is there a configuration file that does this? I want the changes to be system wide. No biggie though

absolutego (ex machina), Monday, 4 April 2005 14:40 (twenty-one years ago)

Whatever configuration file you use to set system-wide environment variables in.

caitlin (caitlin), Monday, 4 April 2005 14:42 (twenty-one years ago)


You must be logged in to post. Please either login here, or if you are not registered, you may register here.