-
Notifications
You must be signed in to change notification settings - Fork 1
Benchmark
Kyle Henfrey edited this page Apr 25, 2020
·
1 revision
Benchmark Stats getting 3056 alliances
//Without Cache
{
time: 9390,
min: 21.368,
max: 176.9022,
avg: 30.479933736910994
}
//With Cache
{
time: 270,
min: 0.3058,
max: 6.9313,
avg: 0.7231498036649214
}Benchmark Code
const Esi = require("node-esi");
Esi("alliances").then(bench).catch(console.error);
Esi.cache();
async function bench(alliances) {
const start = +new Date();
const requests = alliances.data.map(a => Esi(`alliances/${a}`));
const responses = await Promise.all(requests);
const end = +new Date();
const times = responses.map(r => r.requestTime);
console.log({
time: end - start,
min: Math.min(...times) / 1000000,
max: Math.max(...times) / 1000000,
avg: times.reduce((a, b) => a + b) / times.length / 1000000,
});
process.exit();
}