I have some experience with coding but one of the biggest questions which annoying me is how to improve my code.
I every time check the complexity, readability and the correctness of the code but my question is how I can measure the size and the time of specific commands.
For example:
when I have the next problem:
A is an integer
B is an integer
C is an integer
if - A is bigger the B assign C=A
else - C=B
for that problem, we have 2 simple solutions -
1. use if-else statement
2. use ternary operator
for a dry check of the size of the file before compilation, i get that the second solution file is less from the first in a half (for 1000000 operations I get a difference of some MB).
My question is how I can measure the time difference between some codes which make the same operation but with different commands, and how much the compiler makes optimization for commands which is close like the 2 from the example.