Test name | Executions per second |
---|---|
xhr | 13149.5 Ops/sec |
fetch | 11557.9 Ops/sec |
axios | 8378.0 Ops/sec |
superagent | 12041.6 Ops/sec |
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/superagent"></script>
const xhr = new XMLHttpRequest();
xhr.open('GET', 'https://www.googleapis.com/discovery/v1/apis');
xhr.onload = () => console.log(JSON.parse(xhr.responseText));
xhr.send();
fetch('https://www.googleapis.com/discovery/v1/apis')
.then(response => response.json())
.then(console.log)
axios.get('https://www.googleapis.com/discovery/v1/apis')
.then((response) => response.json())
.then(console.log);
superagent.get('https://www.googleapis.com/discovery/v1/apis')
.then(res => {
console.log(res.body);
});