|
写了个简单程序对比下
源代码:(100万次浮点运算, 1ms的systick中断统计时间)
{
int32_t t1, t2;
uint32_t i;
static float ff = 1.0;
t1 = bsp_GetRunTime();
for (i = 0; i < 100*10000; i++)
{
ff = ff * 3.14159;
}
t2 = bsp_GetRunTime();
printf("%f, %dms", ff, t2 - t1);
while (1);
}
在内部RAM运行的执行结果:
-516841996288.000000, 321ms
在SDRAM运行的执行结果
-516841996288.000000, 325ms
在HyperFlash的运行执行结果:
-516841996288.000000, 6214ms
printf打印浮点结果是错误的,这个先不管。运行速度相差19倍是什么鬼?
|
|