Yeah, where’s Riven to pounce on people posting inaccurate stuff? :point:
The former won’t do anything, the compiler will be better than you at optimizing stuff like that in 99.9% of cases. In fact, all you will accomplish is obfuscating your code and wasting time on premature optimization. And it’s micro optimization, which is even worse because it’s usually wrong.
If you really want to get picky, I’d say having a while( true ) anywhere in your code ever is a poor idea. It’s just bad practice to purposefully put an infinite loop anywhere, because if you have complex logic for the break or return statements inside you can mess things up and miss an edge case. Then you’re borked.
As for the latter, as far as I know those memory amounts are correct. But, using a byte or short or whatever rather than just using an int is still a premature optimization most of the time. If you’re allocating a massive state array or something, well okay. But otherwise, why bother until you need it? Most systems have gads of memory now, and in games your bottleneck is going to be image and sound assets, not random variables in memory.