I have a pretty large formula that has to be calculated about 300 times per second. Most of my variables are float, but some variables are just parameters that go into that formula. In some cases, float is not needed. I could use int parameters. But I wonder if mixing int and float types in an calculation would cause the system to cast types around, instead of saving performance.
Share
Be careful about assuming that int operations are always faster than float operations. In isolation they may be, but moving data between a float register and an int register is shockingly slow on modern processors. So once your data is on a float, you should keep it on a float for further computation.