Is there a difference when using floats and or ints.
Like say for calculating the distance between objects or the rotation speed, is it better to use ints or floats. Will it make a difference to CPU?
I am asking because I have recently dug up an old code(tutorial) that uses ints for things like rotationSpeed and maxSpeed, which I usually use floats for.
I am noticing smoothness differences in rotations of objects or so I think. Not sure actually.
So yeah is there a performance difference between ints and floats when using it for such things as speed, rotationSpeed, etc?
Generally speaking, it shouldn’t be any noticable difference, although it really depends on your processor. An AMD FX series is going to have a faster single threaded floating point performance metric with significantly slower floating point multithreaded metric. Intel’s should be more even.
My personal opinion is that in games, this kind of optimization is useless. Your time would be better spent optimizing your memory allocations (reducing garbage) or moving unnecessary computation out of the Update function.