www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Compiler Arguments and Switches

reply MM <MM_member pathlink.com> writes:
Hello again :)

What does this mean ?
-inline
inline expand functions

I also saw the :
-release
compile release version, which means not generating code for contracts and
asserts

Now I get contracts. I though contracts were strange things that slow your
program down as they need to recheck every output. But it is only for testing
purposes, right?

I also don't really get the profiling part, but let me first read that a bit
more thoroughly :)
Jun 19 2006
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"MM" <MM_member pathlink.com> wrote in message 
news:e76p3q$1s3n$1 digitaldaemon.com...

 What does this mean ?
 -inline
 inline expand functions

It means that the compiler will look at your functions, and if it finds a really trivial one, like: int foo(int x) { return x * 2; } Whenever you call foo(), it'll replace it with the actual code from the function. So writefln(foo(4)); will be rewritten internally as writefln(4 * 2); Which then gets simplified down to writefln(8); This can improve execution speed a lot, as the overhead of calling the little function disappears. The biggest speed difference would be if you called the function a lot of times; inlining it really speeds things up.
 I also don't really get the profiling part, but let me first read that a 
 bit
 more thoroughly :)

It's really handy. You can turn on profiling, and when you run your program, it'll generate a profile log, which shows how many times every function was called, how long each function takes to execute (on average), and a bunch of other stuff. Using that information, you can see which functions you probably need to work on speeding up (and which ones you don't that you thought were a bottleneck but really aren't!).
Jun 19 2006
parent MM <MM_member pathlink.com> writes:
This can improve execution speed a lot, as the overhead of calling the 
little function disappears.  The biggest speed difference would be if you 
called the function a lot of times; inlining it really speeds things up.

I thought -O would do this already. But thanks, I'll use that too then :)
 I also don't really get the profiling part, but let me first read that a 
 bit
 more thoroughly :)

It's really handy. You can turn on profiling, and when you run your program, it'll generate a profile log, which shows how many times every function was called, how long each function takes to execute (on average), and a bunch of other stuff. Using that information, you can see which functions you probably need to work on speeding up (and which ones you don't that you thought were a bottleneck but really aren't!).

Jun 19 2006