Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > #define increases compile time significantly

Reply
Thread Tools

#define increases compile time significantly

 
 
Shirsoft
Guest
Posts: n/a
 
      01-16-2007
I have used a #define to reduce code size but it greatly increases the
compile time (from a few secs to 5 mins)
The #define is quite simple

#define UPDATE_VOL_SLICE(VOL,I,J,K, VAL)\
VOL[K][J][I] = VOL[K-1][J-1][I] + VAL\
+ VOL[K-1][J][I-1] - VOL[K-1][J-1][I-1]\
+ VOL[K][J-1][I-1] - VOL[K-1][J-1][I-1]

There are 2 more similar but bigger #define used by my program. They
are used a total of 20 times in the code.

Thanks
Shireesh

 
Reply With Quote
 
 
 
 
=?iso-8859-1?q?Erik_Wikstr=F6m?=
Guest
Posts: n/a
 
      01-16-2007
On Jan 16, 7:58 am, "Shirsoft" <(E-Mail Removed)> wrote:
> I have used a #define to reduce code size but it greatly increases the
> compile time (from a few secs to 5 mins)
> The #define is quite simple
>
> #define UPDATE_VOL_SLICE(VOL,I,J,K, VAL)\
> VOL[K][J][I] = VOL[K-1][J-1][I] + VAL\
> + VOL[K-1][J][I-1] - VOL[K-1][J-1][I-1]\
> + VOL[K][J-1][I-1] - VOL[K-1][J-1][I-1]
>
> There are 2 more similar but bigger #define used by my program. They
> are used a total of 20 times in the code.


Anything wrong with a normal inlined function?

--
Erik Wikström

 
Reply With Quote
 
 
 
 
Shirsoft
Guest
Posts: n/a
 
      01-16-2007
Some time back i had tested the speed of inline to actual code and the
speed was not same. The inline code was slower. Will try again and let
you know

Erik Wikström wrote:
> On Jan 16, 7:58 am, "Shirsoft" <(E-Mail Removed)> wrote:
> > I have used a #define to reduce code size but it greatly increases the
> > compile time (from a few secs to 5 mins)
> > The #define is quite simple
> >
> > #define UPDATE_VOL_SLICE(VOL,I,J,K, VAL)\
> > VOL[K][J][I] = VOL[K-1][J-1][I] + VAL\
> > + VOL[K-1][J][I-1] - VOL[K-1][J-1][I-1]\
> > + VOL[K][J-1][I-1] - VOL[K-1][J-1][I-1]
> >
> > There are 2 more similar but bigger #define used by my program. They
> > are used a total of 20 times in the code.

>
> Anything wrong with a normal inlined function?
>
> --
> Erik Wikström


 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      01-16-2007
Shirsoft wrote:

Please don't top-post. Corrected.
>
> Erik Wikström wrote:
>
>>On Jan 16, 7:58 am, "Shirsoft" <(E-Mail Removed)> wrote:
>>
>>>I have used a #define to reduce code size but it greatly increases the
>>>compile time (from a few secs to 5 mins)
>>>The #define is quite simple
>>>
>>>#define UPDATE_VOL_SLICE(VOL,I,J,K, VAL)\
>>> VOL[K][J][I] = VOL[K-1][J-1][I] + VAL\
>>> + VOL[K-1][J][I-1] - VOL[K-1][J-1][I-1]\
>>> + VOL[K][J-1][I-1] - VOL[K-1][J-1][I-1]
>>>
>>>There are 2 more similar but bigger #define used by my program. They
>>>are used a total of 20 times in the code.

>>
>>Anything wrong with a normal inlined function?
>>

> Some time back i had tested the speed of inline to actual code and the
> speed was not same. The inline code was slower. Will try again and let
> you know


Then it wasn't being inlined.

Check your compiler's documentation for inline code size and optimisations.

--
Ian Collins.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
computation at compile time i.e. compile time functions usingtemplates Carter C++ 2 03-04-2009 06:43 PM
Lithium Ion hold significantly more charge than NiMH? void Digital Photography 53 01-19-2007 07:53 PM
my cisco 831 is giving limiting my upload speeds significantly... please help xyyz Cisco 0 01-08-2007 06:52 AM
New DCRAW version 7.xx , significantly rewritten code. Bart van der Wolf Digital Photography 3 03-14-2005 01:30 PM
Setting wrap mode in wxStyledTextCtrl will significantly make the performance down J.R. Python 0 03-02-2004 02:38 AM



Advertisments