CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2008
    Posts
    163

    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

  2. #2
    Join Date
    Jan 2009
    Posts
    1,689

    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.

  3. #3
    Join Date
    Apr 2008
    Posts
    163

    Re: Compiler Directives

    I am asking about the compiler directives to speed up the code.

    Thanks
    Dave

  4. #4
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    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.

  5. #5
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    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
  •  





Click Here to Expand Forum to Full Width

Featured