I have a normal HTTP request (no Ajax) and I return a response from server side. This takes around 350ms. The same response when returned through an Ajax call takes only 50 ms.
I checked also the processing or the time taken to prepare the response on the server side. This time is the same for both the requests. (For example, in both cases MyServlet handles the request开发者_JAVA百科 and returns the response. I gave sysout in the doPost method and the time spent inside the Servlet is the same).
I hope you are aware, that AJAX is asynchronous? Could it be that you are measuring the time the call returns (should return immediately) and not until an actual response is received (onSuccess event called)?
精彩评论