Permalink
Browse files

shorter ssr bench output

  • Loading branch information...
1 parent ea7c353 commit e4a49b7432d0c734cf96663cb5c4a27f1fa4179c @yyx990803 yyx990803 committed Dec 3, 2016
Showing with 11 additions and 8 deletions.
  1. +11 −8 benchmarks/ssr/renderToStream.js
@@ -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()
})

0 comments on commit e4a49b7

Please sign in to comment.