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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ramesh116
    New Member
    • Dec 2015
    • 1

    #1

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

    if ( i == j )
    i++ ;
    j-- ;


    --------------------
    if ( i == j )
    i++ ;
    else
    j-- ;
    j += i ;
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    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??

    Comment

    Working...