Is there a way to find the size of the code and what is its runtime to compare the two codes and decide which is better?
For example, let's say I want to find the size and runtime of this
Code 1
for(int i=0; i<5; i++) { sum+=1; }
and this one
Code 2
for(int i=0; i<=4; i++) { sum = sum + 1; }
to decide which is better (now I don't need this example). For example, the result would be:
Code 1: Size: ? KB Time: ? ms Code 2: Size: ? KB Time: ? ms
a1204773
source share