cancel
Showing results for 
Search instead for 
Did you mean: 

The Code Execution Speed Became Slower and Slower

letters ling
Associate
Posted on May 08, 2017 at 10:20

Good afternoon,sir:

Could you tell me how to solve the question about the code execution speed became slower and slower?

When I adjusted the circuit board which the CPU is

http://www.kynix.com/uploadfiles/pdf65976/STM32F103C4T6A.pdf

,I found that the executing speed of code became slower and slower.The specific performance is :
  • In the beginning,all configurations and function modules are initializing,they are finishing just in few seconds.

  • With the increasing of adjusting time,the above executing time also increasing gradually.Up to now,it need about 90 seconds to finish which is unacceptable !

Does the memory leak then it lead to the code execution speed slower and slower ?  Or has any reasons occurred here?

Please give me some suggestions ! Thank you a lot !

3 REPLIES 3
AvaTar
Lead
Posted on May 08, 2017 at 12:47

When you give a comparative judgement like 'faster'/'slower', it is very useful to show WHAT you measured, and HOW.

Otherwise it's impossible for others to reproduce or judge your results, or give any recommendation.

S.Ma
Principal
Posted on May 08, 2017 at 12:51

With so little details shared, it maybe challenging to give advice... Is the code bare metal, using rtos? What are the interrupt sources used in the aplication? How is the mcu clock frequency coming from? Usually there is no dynanic memory management in bare metal apps. Reduction of performance usually means sysclock frequency changed, low power modes, or some interrupts are not cleared properly and will slow down processing.

Posted on May 08, 2017 at 13:06

Suggest you profile your code so you understand where the time is being spent. 

Do you use bubblesorts? Do you use high frequency interrupts? 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..