-
-
Save barbagrigia/a1d8280ee6b929a71953ca62e4f3204c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
let browser = puppeteer.launch({ | |
args: ['--no-sandbox', '--disable-setuid-sandbox'], | |
}); | |
async function test(url) { | |
browser = await browser; | |
const page = await browser.newPage(); | |
const a = Date.now(); | |
await page.goto(url, { | |
timeout: 60000, | |
}); | |
await page.waitForSelector('#root', { timeout: 10000 }); | |
console.log(Date.now() - a); | |
return Date.now() - a; | |
} | |
(async function go() { | |
const results = []; | |
for (let i = 0; i < 10; i++) { | |
const res = await test('https://new.codesandbox.io'); | |
results.push(res); | |
} | |
browser.close(); | |
const total = results.reduce((p, n) => p + n, 0); | |
const avg = total / results.length; | |
console.log('AVG: ' + avg); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment