By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,379 Members | 3,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,379 IT Pros & Developers. It's quick & easy.

Measure the execution time of if then and if then else statment

P: 1
if ( i == j )
i++ ;
j-- ;


--------------------
if ( i == j )
i++ ;
else
j-- ;
j += i ;
Dec 18 '15 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
Call the time function before an after the statement to be tested.

Put the statement to be tested in a loop.

Run the loop a million times or more so there is a difference in the time readings.

Execute the program inside the debugger to avoid the time required to display results.

I guess my only question is why??
Dec 19 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.