-
November 21st, 2010, 09:22 AM
#1
Compiler Directives
Hi,
For every program a speedy execution is mandatory objective.
for this purpose how can i approach the compiler for faster execution of a program.
what are the macros used for this purpose.
i am using ANSI C and working in Visual studio 2008.
when i increase the code size the cache size is shorted. it is harmful for the speed. So i neglect the technique like loop unrolling.
Thanks
Dave
-
November 21st, 2010, 03:20 PM
#2
Re: Compiler Directives
A couple of problems here. Last I heard, Visual Studios doesn't have a proper C compiler, it lacks C99 support.
Second, are you asking for macros to speed up code or compiler directives? I'm not sure what you mean by macros to speed up execution, macros are handles before compilation even starts.
-
November 22nd, 2010, 02:13 PM
#3
Re: Compiler Directives
I am asking about the compiler directives to speed up the code.
Thanks
Dave
-
November 22nd, 2010, 02:17 PM
#4
Re: Compiler Directives
The biggest increases in execution speed won't come from compiler directives; they'll come from choosing an algorithm with a better big-Oh running time in the first place.
However, assuming you've chosen an optimal algorithm and you've avoided speed penalties such as unnecessary container copying, you could start looking at whether parallelizing with SSE is appropriate for your task. Be warned, it's non-trivial (if it weren't the compiler would just do it for you) and not suitable for every program.
-
November 23rd, 2010, 06:36 AM
#5
Re: Compiler Directives
From our performance tests, we select...
Optimization = Full optimisation /Ox
Inline function expansion = Any suitable /Ob2
Enable intrinsic functions = Yes /Oi
Favor size or speed = Neither
Whole program optimization = Enable link-time code generation /GL
Enable enhanced instruction set = Streaming SIMD extensions /arch:SSE2
Floating point model = Fast /fp:fast
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|