Files
shields/scripts/benchmark-performance.js
Pierre-Yves B 097bf87e41 Make it easier to benchmark and profile the code (#4780)
* Make it easier to benchmark and profile the code

* Remove unnecessary escape

* Clarify that the backend server is started without the frontend

* Add missing NODE_CONFIG_ENV environment variable

* Add error message when user has not included console.time statements

* Fix lint issue

* Handle multiple console.time statements

* Switch NODE_CONFIG_ENV to test

* Switch to const as variable never re-assigned
2020-03-22 20:45:53 +01:00

27 lines
594 B
JavaScript

'use strict'
const config = require('config').util.toObject()
const got = require('got')
const minimist = require('minimist')
const Server = require('../core/server/server')
async function main() {
const server = new Server(config)
await server.start()
const args = minimist(process.argv)
const iterations = parseInt(args.iterations) || 10000
for (let i = 0; i < iterations; ++i) {
await got(`${server.baseUrl}badge/coverage-${i}-green.svg`)
}
await server.stop()
}
;(async () => {
try {
await main()
} catch (e) {
console.error(e)
process.exit(1)
}
})()