I mean a simple optimisation is to filter out the physical intersections by using mathematical ones at first, so that you reduce computation time. In my example you see how I created 30001 objects. I simply added a bounding box intersection before doing the physical one, because I don’t need to do them on all.

In my previous posts (which I deleted) I was thinking that you are directly refering to RhinoObjects, so that a preselection (which might work similar) can be exploited. There are a couple of other optimisations possible, but this simple trick reduces computation already drastically:

ptest.gh (10.8 KB)

```
public Point3d FullRayShoot(Ray3d ray, IEnumerable<Brep> breps, out int hitFace, out bool success)
{
success = false;
hitFace = 0;
Line rayLine = new Line(ray.Position, ray.Direction, 999999999999);
var returnPoint = new Point3d();
double minDist = 9999999999;
int i = 0;
foreach (Brep bp in breps)
{
// Get Bounding-Box
BoundingBox bb = bp.GetBoundingBox(false);
Interval linePM; // irrelevant
// Filter by using mathematical intersection
if (Rhino.Geometry.Intersect.Intersection.LineBox(rayLine, bb, 0.1, out linePM))
{
NurbsCurve rayCrv = rayLine.ToNurbsCurve();
Curve[] curves;
Point3d[] points;
bool interResult = Rhino.Geometry.Intersect.Intersection.CurveBrepFace(rayCrv, bp.Faces[0], 0.001, out curves, out points);
if(interResult)
{
if (points.Length != 0)
{
double dist = points[0].DistanceTo(ray.Position);
if (dist < minDist && dist > 0.001)
{
hitFace = i;
success = true;
returnPoint = points[0];
minDist = dist;
}
}
}
}
i++;
}
return returnPoint;
}
```