在Delphi 2009中sqrt仍然很慢吗? [英] Is sqrt still slow in Delphi 2009?

查看:111
本文介绍了在Delphi 2009中sqrt仍然很慢吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Delphi 2009中sqrt仍然很慢吗?

Is sqrt still slow in Delphi 2009?

旧的技巧(查找表,近似函数)是否仍然有用?

Are the old tricks (lookup table, approx functions) still useful?

推荐答案

如果您要处理的是一小部分非常大的数字,那么查找表通常会更快.如果您要处理大量的小数字,那么即使慢速执行例程也可能比维护大表更快.

If you are dealing with a small set of really large numbers then a lookup table will most always be faster. While if you are dealing with a large set of small numbers then even a slow routine may be faster then maintaining a large table.

我查看了System.pas(位于 SQRT 所在的位置),尽管有许多标记为 Fastcode项目 中的许可证, SQRT 不是.实际上,它只是对 FSQRT 进行了汇编调用,因此它很可能没有发生变化.因此,如果它在某一点上相对较慢,那么它很可能仍然同样较慢(尽管您的CPU可能会更快并且为此进行了优化……)

I looked in System.pas (where SQRT is located) and while there are a number of blocks marked as licensed from the Fastcode project, SQRT is not. In fact, it just makes an assembly call to FSQRT, so it most likely hasn't changed. So if it was comparatively slow at one point then it most likely still is as slow (although your CPU may be a lot faster and optimized for that now . . . .)

我的建议是查看您的用法和测试.

My recommendation is to look at your usage and test.

这篇关于在Delphi 2009中sqrt仍然很慢吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆