Alex Rivera | Logout

Is there any performance difference when using different HTTP methods?

Asked 2012-08-06T17:51:11.030
8

I know how HTTP methods work and for what they are designed, but I'm curious to know if some methods are faster than others when using just to get data.
In the team I'm working on I noticed a lot of JQuery ajax requests like this below:

$.ajax({url: "../dir/someFile.json", method: 'post', dataType: 'json',
    error: function(...){ ... },
    success: function(...){ ... }       
});

I'd obviously use a 'get' method, as no data is sent to this request. This probably happened when a teammate was copying and pasting code. This works fine also, seems there's no good reason for changing it to 'get'.

I think using 'get' method would be faster in this case, but I didn't find any source affirming that.

Edit
Report

1 Answer

3

There is some research that shows that some browsers will divide a POST request into multiple packets. This could have a performance impact, which you'd think would make the request slower. But, under tests it seems that POST can sometimes be faster. I'm not sure why this is.

In practice however, the performance difference is negligible and you should use POST and GET as intended.

Read:

answered 2012-08-06T18:31:44.380

Your Answer