Thread: stack frame..

  1. #1
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683

    stack frame..

    I was trying to optimize my code and noticed that in the function call stack my there were 18 frames... It this high or is it quite normal..

    I am trying to make some functions inline...
    any suggestions...

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Inline function could lead to bloated compiled code. How aften does the application call the function?

    Kuphryn

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Have you tried turning on the compilers optomization?

  4. #4
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Quote Originally Posted by kuphryn
    Inline function could lead to bloated compiled code. How aften does the application call the function?

    Kuphryn

    well since its a server application the functions are called say atleast 20 to 30 times in a given second (based on load)....

    and yes I have tried using the O2 and O3 flags in gcc

  5. #5
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    I think kuphryn meant how often does the function get called inside of the code, not how often does it get called during runtime.

    Have you tried just using the O1 flag? Remember that O2 and O3 don't always give the best results (because best is subjective)

    Now when you say there were 18 frames, do you mean that the frame pointer was adjusted 18 times in the same function or that the function was 18 functions deep? If its the former then there is something going wrong, if its the later it doesn't sound that bad.

  6. #6
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Quote Originally Posted by Thantos
    I think kuphryn meant how often does the function get called inside of the code, not how often does it get called during runtime.

    Have you tried just using the O1 flag? Remember that O2 and O3 don't always give the best results (because best is subjective)

    Now when you say there were 18 frames, do you mean that the frame pointer was adjusted 18 times in the same function or that the function was 18 functions deep? If its the former then there is something going wrong, if its the later it doesn't sound that bad.
    thanx... i will try the O1 flag... The function is called from around 8 places int he code.... and the function was 18 functions down.. seems ok then..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stack and pointer problem
    By ramaadhitia in forum C Programming
    Replies: 2
    Last Post: 09-11-2006, 11:41 PM
  2. Animation not working....
    By aquinn in forum C Programming
    Replies: 7
    Last Post: 02-19-2005, 05:37 AM
  3. Question about a stack using array of pointers
    By Ricochet in forum C++ Programming
    Replies: 6
    Last Post: 11-17-2003, 10:12 PM
  4. error trying to compile stack program
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-03-2003, 06:27 PM
  5. Stack Program Here
    By Troll_King in forum C Programming
    Replies: 7
    Last Post: 10-15-2001, 05:36 PM