[Solved] What code is more CPU expensive: while(*p) or while(i–)? [closed]

*pointer nominally requires a fetch from memory, and that is generally the most expensive of the operations shown in your code. If we assume your code is compiled directly to the obvious assembly corresponding to the operations as they are described in C’s abstract machine, with no optimization, modern CPUs for desktop computers are typically … Read more

[Solved] Micro-optimizations: if($var){ … } vs if($var): … endif [closed]

I’m sure the difference is negligible, if there is any. If the difference is important to you, you should probably use a faster (likely compiled) language. You would do better optimizing more intensive things, like databases first (and writing clean code, as @Tim stated). solved Micro-optimizations: if($var){ … } vs if($var): … endif [closed]