Tag: 犀牛

递归方法比交互方法慢10倍

尽可能清理代码以显示我的问题。 基本上它是八叉树搜索+相交。 交叉函数来自SDK(整个项目是rhino的插件)。 如果我使用交叉调用进行循环,它比通过八叉树的递归搜索快10倍。 陌生人甚至 – 我隔离了交叉调用的时间 – 并且在递归内部它比循环中慢8倍。 可能有1000个原因,为什么它的行为像这样,但我希望我做了一些明显的错误,有人可以通过查看代码发现。 有一个缓慢的背诵片: public void NewRayCast() { int runs = 500000; //how many rays we cast Point3d raypos = new Point3d(0, 0, 0); //raystart Ray3d ray = new Ray3d(); Random r = new Random(); //here we create targets to scatter the ray directions Vector3d[] targets = new […]