F#与C#的“不安全”块具有相同的语法

许多阵列边界检查会降低速度,这对2D阵列尤其如此.有没有办法在F#中编写不安全的代码块?

解决方法

我不是一个 F#程序员,但据我看来,它似乎没有 unsafe关键字.

您可以通过将2D数组转换为一维数组来获得性能提升.

Advice 5: Until we get this right,I
would suggest that .NET users do what
many C++ numerical programmers do:
write a class to implement your
n-dimensional array. This would be
represented as a 1-dimensional array,
and the relevant accessors would
convert n indices into 1 via
appropriate multiplications. We
almost certainly wouldn’t eliminate
the bounds check into the 1-d array,
but at least we’d only do one check!

Array Bounds Check Elimination in the CLR

相关文章

在要实现单例模式的类当中添加如下代码:实例化的时候:frmC...
1、如果制作圆角窗体,窗体先继承DOTNETBAR的:public parti...
根据网上资料,自己很粗略的实现了一个winform搜索提示,但是...
近期在做DSOFramer这个控件,打算自己弄一个自定义控件来封装...
今天玩了一把WMI,查询了一下电脑的硬件信息,感觉很多代码都...
最近在研究WinWordControl这个控件,因为上级要求在系统里,...