Now I'm by no means a programmer, so I might be reading your code wrong.
However what you could do to speed it up is put in a cutoff distance which is equal to the velocity.magnitude of your submarine. if it returns true check if the sub is moving towards or away, if it is moving towards then do a collision check on the nearest point not all of them.
Another way to do it without using rays is use a combination of box, sphere and ellipsoid as a "bounding box" for your sub and do collision checks on those. The math for primitive objects is far simpler to deal with than what you're trying atm.
However what you could do to speed it up is put in a cutoff distance which is equal to the velocity.magnitude of your submarine. if it returns true check if the sub is moving towards or away, if it is moving towards then do a collision check on the nearest point not all of them.
Another way to do it without using rays is use a combination of box, sphere and ellipsoid as a "bounding box" for your sub and do collision checks on those. The math for primitive objects is far simpler to deal with than what you're trying atm.