[linux-audio-dev] code in different files affects speed?

Sebastien Metrot meeloo at noos.fr
Sun Dec 8 11:04:01 UTC 2002


It mainly depends on the compiler and the linker. For exemple most C/C++
compiler will try to inline small functions automatically when compiling
with all optimisations. Most of the time this inlining is only possible when
both the caller and the target function are compiled from the same source
file. However there is a feature of Visual C++ 7 under windows that permits
to inline functions from other .c/.cpp source files, and there is another
method named Global Optimisation that permits the linker to reorganize
object code to optimise register usage and calling conventions accross
function calls. I'm not sure gcc provides these features are of now but the
effect is often spectacular concerning the resulting speed gain (typically
10 to 15% compared to the same code compiled with VC6 or without these
optimisations).

Of course sometimes the optimizer guess wrong and it results in strange bugs
but it only occured to me once in almost one year of daily use, and i
couldn't even prove it was not MY fault :).

I giess the simple answer is: yes.

Hope it helps,

Sebastien

----- Original Message -----
From: "Paul Davis" <paul at linuxaudiosystems.com>
To: <linux-audio-dev at music.columbia.edu>
Sent: Sunday, 08 December, 2002 16:48
Subject: [linux-audio-dev] code in different files affects speed?


> does anyone here know if splitting code across different files, or for
> that matter, reordering the layout of one source file so that
> functions called together are now "far apart" can actually affect
> execution speed?
>
> --p




More information about the Linux-audio-dev mailing list