mirror of https://github.com/vuejs/vue.git
shorter ssr bench output
This commit is contained in:
parent
ea7c353902
commit
e4a49b7432
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
'use strict'
|
||||
|
||||
const Vue = require('../../dist/vue.runtime.common.js')
|
||||
|
@ -7,20 +9,21 @@ const gridComponent = require('./common.js')
|
|||
|
||||
console.log('--- renderToStream --- ')
|
||||
const self = (global || root)
|
||||
self.s = self.performance.now()
|
||||
const s = self.performance.now()
|
||||
|
||||
const stream = renderToStream(new Vue(gridComponent))
|
||||
let str = ''
|
||||
const stats = []
|
||||
let first
|
||||
let complete
|
||||
stream.once('data', () => {
|
||||
first = self.performance.now() - s
|
||||
})
|
||||
stream.on('data', chunk => {
|
||||
str += chunk
|
||||
stats.push(self.performance.now())
|
||||
})
|
||||
stream.on('end', () => {
|
||||
stats.push(self.performance.now())
|
||||
stats.forEach((val, index) => {
|
||||
const type = index !== stats.length - 1 ? 'Chunk' : 'Complete'
|
||||
console.log(type + ' time: ' + (val - self.s).toFixed(2) + 'ms')
|
||||
})
|
||||
complete = self.performance.now() - s
|
||||
console.log(`first chunk: ${first.toFixed(2)}ms`)
|
||||
console.log(`complete: ${complete.toFixed(2)}ms`)
|
||||
console.log()
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue