Difference in time calculated and time displayed in postman

1.3k Views Asked by At

I am trying to compare the time taken to execute web api and the time that is displayed in the body portion of the postman:

postman

Below is the code to calculate the time to execute webAPI:

    starttime = environment.tickcount
    executeasync()
    endtime = environment.tickcount
    calculatedTime = (endtime-starttime) /1000;

The calculatedTime's value is different than the time displayed in postman.

Is there something am missing?

Thanks

1

There are 1 best solutions below

0
On

I'm making an assumption that the code you posted above is running on the server:

starttime = environment.tickcount
executeasync()
endtime = environment.tickcount
calculatedTime = (endtime-starttime) /1000;

This will be different that the time that postman reports. I'm not sure of the internal implementation in postman but I assume the TIME value is calculated from the time the request is sent to the time the response is received. Based on the code above it looks like you are effectively just timing just the call to executeAsync. There are other factors that determine the round trip time for example network latency. In short the time that a client sends a request and receives a response will not perfectly match up with the server receiving the request and generating the response.