My Bounding Box timings (on dpmlh045). Please note that I in no way expect you to get close to this, for this simple exercise. I simply want you to see what sort of performance benefit thinking a little about your implementation can give. For debug (i.e., -p -pg options to g++): ----------------------------------------- (100,000 random rays) "Found 4000 intersection in 0.300000 sec" (1,000,000 random rays) "Found 40522 intersection in 3.040000 sec" (10,000,000 random rays) "Found 404033 intersection in 24.809999 sec" Profiling (Debug Version): main() fRandom() BBoxIntersect() RandomSphereVector() -------------------------------------------------------------------------------------- 100000* | 0% | 50.08% | 12.52% | 25.04% 1000000** | 10.16% | 60.97% | 8.71% | 5.81% 10000000 | 8.93% | 62.41% | 8.53% | 6.08% * = Not running long enough to get statistically relevant samples ** = Not running long enough to get consistant results from run-to-run ------------------------------------------------------------------------------------- For optimized (i.e., -O3 options to g++): ----------------------------------------- (100,000 random rays) "Found 4000 intersection in 0.070000 sec" (1,000,000 random rays) "Found 40522 intersection in 0.720000 sec" (10,000,000 random rays) "Found 404033 intersection in 5.810000 sec"