在MAF管道中移动数组非常慢 [英] Moving arrays across MAF pipeline is very slow

查看:36
本文介绍了在MAF管道中移动数组非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个项目,我将大型数组从MAF管道移动到插件,这需要很长时间。我只是通过管道传递数组,没有深度复制或迭代。



传递3个291,000个项目的数组,1个数组长,1个数组为double和另一个数组作为枚举,需要3,150ms。获得291,000双打的数组不到1ms。



在主机中

Hi,

I have a project where I'm moving large arrays across a MAF pipeline to an addin and it's taking a very long time. I'm just passing arrays across calls through the pipeline with no deep copying or iterations.

To pass 3 arrays of 291,000 items, 1 array as long, 1 array as double and the other array as enums, takes 3,150ms. Getting an array of 291,000 doubles back takes less than 1ms.

In the Host

addinFunction.SetArrays(array1, array2, array3);





在实际插件中的签名是





in the actual addin the signature is

public void SetArrays(long[] array1, double[] array2, myEnum[] array3);



两个侧面适配器只做类似


both side adapters only do something like

public void SetArrays(long[] array1, double[] array2, myEnum[] array3)
{
     _view.SetArrays(array1, array2, array2);
}



任何人都有任何想法或提示吗?



非常感谢提前。

Hank


Anyone have any ideas or hints?

Many thanks in advance.
Hank

推荐答案

join array

join array
var z = new int[x.Length + y.Length];
x.CopyTo(z, 0);
y.CopyTo(z, x.Length);



或更改为字节


or change to byte

byte[] firstArray = {2,45,79,33};
byte[] secondArray = {55,4,7,81};
byte[] result = firstArray.Concat(secondArray).ToArray();


这篇关于在MAF管道中移动数组非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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