1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/bench/index.js

33 lines
751 B
JavaScript
Raw Normal View History

2016-10-13 20:01:11 +00:00
import { resolve } from 'path'
import build from '../server/build'
import { render as _render } from '../server/render'
import Benchmark from 'benchmark'
const dir = resolve(__dirname, 'fixtures', 'basic')
const suite = new Benchmark.Suite('Next.js')
2016-10-13 20:01:11 +00:00
suite
.on('start', async () => build(dir))
.add('Tiny stateless component', async p => {
await render('/stateless')
p.resolve()
}, { defer: true })
.add('Big stateless component', async p => {
await render('/stateless-big')
p.resolve()
}, { defer: true })
.add('Stateful component with a loooot of css', async p => {
await render('/css')
p.resolve()
}, { defer: true })
module.exports = suite
function render (url, ctx) {
return _render(url, ctx, { dir, staticMarkup: true })
}