How can the execution time of exactly same code differ??

I pasted the same Java code for Factorial problem but was surprised to see that in the first attempt the execution time was 3.22 and in the second attempt with exactly the same code the execution time was 3.06…

Can someone provide a reason for this difference in execution time for exactly same code copy pasted.

Does the speed of Internet Connection effect the execution time??

I doubt that the internet connection plays a role in it, as it is should run serverside. I can only guess why it differs as it does, because I don’t know how they measure the time.

  • It might be that the server it is run on, was already very busy with other stuff.
  • It might be that the garbage collector just happened to be more busy in the first attempt (you never know when it kicks in).
  • Maybe the time measurement itself is inaccurate, which happens easily, if you don’t follow certain guide lines.

No internet connection doesn’t affect the execution time it maybe a result of server load at the time when you submitted it.

Don’t you think 1 question mark (?) was enough, just saying.

@amit001: Don’t you think for representing a question mark the English alphabet was enough, just saying.

1 Like
//