我正在uint64
的短数组中对f#进行大量计算;我想堆栈分配它们以避免垃圾收集器运行。在C ++中,我会这样做:
int search(int n, uint64_t* data) {
while ( /* something */ ) {
// ... do some computation on data.
uint64_t* data2 = (uint64_t*) alloca(n * sizeof(uint64_t));
for (int i=0; i<n; ++i) { data2[i] = /* compute derived value */; }
int candidate = search (n, data2);
// ... determine if candidate is better than best etc.
}
}
但是f#似乎没有原始的,堆栈分配的数组类型?