Axios vs Superagent

后端 未结 2 692
挽巷
挽巷 2021-02-08 19:40

If I use Axios and Superagent to make a call to the same api one after another I get Superagent\'s response first in the console logs in both cases i.e if I call one first than

2条回答
  •  遥遥无期
    2021-02-08 20:39

    The difference is unlikely to be related to the raw speed of the client. Both use Node’s HTTP library or the browser’s built-in XMLHttpRequest. Most likely what you’ve observed are slight differences in timing related to event handling.

    I’d base my decision on other factors, like which API you like better, and library size (for a browser-side application).

    Here’s a browser-side test case for Axios and SuperAgent: https://jsperf.com/axios-vs-superagent/ and here’s a server-side test: https://gist.github.com/natesilva/24597d954f392b21467b83403756f121

    For me, on these tests, Axios is faster in the browser and SuperAgent is faster under Node.js.

提交回复
热议问题