3

I have an angular app with which has a few $http.get calls some with a success/error funcs others just as below. After trying to increase the speed of the app, I noticed that changing the $http.get calls to jquery calls the app sped up. So are jquery calls faster than angular $http calls, if so I'll change all my get request to jquery.

$http.get('/event/'+ _id);

$.ajax({url: '/event/'+ _id  });

Has anyone else noticed this?

3
  • 3
    You should extend your question a bit. What is faster, the code or the request response time? How much faster, ~5ms, ~10ms ~100ms? How do the request headers look like for both requests? Is the difference consistant or only on subsequent requests? Commented Jan 3, 2015 at 0:02
  • The response time was faster, I'll have to double check the headers sent. Commented Jan 5, 2015 at 4:31
  • simply do a for loop, assume 1 million $http and $.ajaxx. the u will get the result. both suppose using xmlhttpreques for backend request if i not wrong. Commented Jan 5, 2015 at 6:48

1 Answer 1

2

I wouldn't expect much of a gain, if any. HTTP requests are expensive, your biggest bottle neck will always be the network. So, it doesn't matter how fast the code is when the network takes over a second. With that being said, check HTTP headers to check which one is more verbose. If you get rid of $http.get you also lose the seamless ability to unit test since you now have to mock $.ajax.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.