Some low-level optimizations

Oh and re foreach: I like that syntactic sugar - but why do you think it is faster? The only opinions I heard about foreach over an array and especially an ArrayList was that it is slower!

irrisor said:
edit: some classes in the core rely on it - e.g. SimpleLightNode does not initialize lightRotate but only passes it to mult and assign the result to the field again - it may get tedious to find all those places :|


Yeah, the 'right' way to do it would be to initialize it to a new Quaternion(), which would also avoid the continual assignment every time updateWorldData() is called.

I dunno, there's that old saying about lies, damn lies, and benchmarks…  Microbenchmarks to try and prove some bit of code are almost always very dependant on so many factors (CPU, video card, bus speed, OS, other programs running) that unless a very large difference is shown, it's probably meaningless making it hard to justify changing behavior of code.  Personally, I think removing all the "null"s and "new"s is a bad idea…  among other things, it allows us to reduce code redundancy.

i think there is no code redundancy in using a 'new Type()' parameter instead of 'null'. actually i think that explicitly initializing objects is a good practice in most public methods. i don't like the idea to pass list of null arguments and expect the engine to magically initialize them for me (or not).

also think of cases where a method is called by 'mistake' (or bug - i don't know how to call it) with a null argument. in such cases you actually conceal a bug and debugging might become really nasty.