sprintf(rgbhChar,"%4.4f",1234.5678);
After testing it, this sentence took 18740 machine cycles.
In my impression, I have tested Keil's C51 before, and it seems that the more complicated conversion is only 2K~4K machine cycles (a long time, is the memory accurate?)
The current CPU is STM32F449, the compiler is IAR, and the hardware multiplier has been selected in the engineering tab.
Why is it so slow?
Jihan Posted on December 21, 2020
Is the test code on C51 consistent? Could it be caused by different test conditions?
Mulan Posted on December 21, 2020
It is useful to compare under the same conditions; it is recommended to figure out what the c51 is.
Bailyn Posted on December 21, 2020
1. Why is the instruction (cycle) difference after compilation for the same C statement so much? Is this the case for the reduced instruction set?
2. For library functions, they should all be provided with obj, that is, they are all pre-compiled.
Wing Posted on December 21, 2020
This is the characteristic of the reduced instruction set. For the same operation, the number of compiled instructions will be much larger (depending on what you are doing, some require more instructions, some require less).