
2008/7/9 Mitar
And it took 15 s. And also the profiling was like I would anticipate. Calculating points coordinates and checking spheres takes almost all time.
So any suggestions how could I build a list of objects to check at runtime and still have this third performance? Why this big difference?
I think the speed difference really comes from using a list to hold the spheres in your first two examples, to referring to them directly in case statements in your last example. Lists are going to introduce indirections and therefore are slower than referring directly to the values themselves. Maybe you would have better luck using arrays? Template Haskell is also an option - if you want to "hard code" your scene in another module, TH can turn it into that kind of case statement. Of course, as the scenes get more complex a series of nested cases isn't going to be too effecient. Justin