Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/30/04 10:16
Read: times


 
Msg Score: -1
 -1 Answer is Wrong
#84096 - Need some more details
Responding to: ???'s previous message
Hi Shahzad,
Which Compiler are you using ?

Some compilers generate the local variables (defined within the function) onto the stack. Hence any activity, you do with this variable, the compiler always reads this variable from the stack, performs the action and then stores it back on Stack; hence it takes a long time.

In your code you have defined a whole lot of local variables within the function, so it is obvious that these routines will run very slow if these variables are made in stack by your compiler.
In such a case, you can define your variables as global variables. These wil take up your internal (or external) memory, but will be able to atleast see if the routine is working faster or not.

In situations where I need to define a lot of variables, I generally define a global Buffer of 16 bytes. This buffer is used as scratch pad in many routines. This helps me reducing the number of global variables and makes my code run faster.

There are other ways to test if the variable is generated in stack or internal RAM.

Check if your compiler has options for Compiling you program for a.High Speed, or b.Small Program Size, or c.Optimize Memory.
Try by changing these options and see the result.

Bye,
from Mr. Kiran V. Sutar.




List of 22 messages in thread
TopicAuthorDate
C Code t o Assembly            01/01/70 00:00      
   C to Asm            01/01/70 00:00      
   C Code t o Assembly            01/01/70 00:00      
      only one table            01/01/70 00:00      
   Need some more details            01/01/70 00:00      
      Not even true !            01/01/70 00:00      
      Answer is Wrong!!            01/01/70 00:00      
   Re : previous 3 replies and Paul            01/01/70 00:00      
      Previously on 8052.com            01/01/70 00:00      
      Overflow            01/01/70 00:00      
      just one array            01/01/70 00:00      
         too limited, Paul            01/01/70 00:00      
         Nothing to do with scope            01/01/70 00:00      
            Agreed            01/01/70 00:00      
   No success !            01/01/70 00:00      
   Re: Peter            01/01/70 00:00      
   to assembly            01/01/70 00:00      
   Example code            01/01/70 00:00      
   Any unused functions in your program?            01/01/70 00:00      
   query            01/01/70 00:00      
      Off-Topic - start a new thread            01/01/70 00:00      
         ... and use a _descriptive_ subject!            01/01/70 00:00      

Back to Subject List