Skip to content

Commit e4a49b7

Browse files
committed
shorter ssr bench output
1 parent ea7c353 commit e4a49b7

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

benchmarks/ssr/renderToStream.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-unused-vars */
2+
13
'use strict'
24

35
const Vue = require('../../dist/vue.runtime.common.js')
@@ -7,20 +9,21 @@ const gridComponent = require('./common.js')
79

810
console.log('--- renderToStream --- ')
911
const self = (global || root)
10-
self.s = self.performance.now()
12+
const s = self.performance.now()
1113

1214
const stream = renderToStream(new Vue(gridComponent))
1315
let str = ''
14-
const stats = []
16+
let first
17+
let complete
18+
stream.once('data', () => {
19+
first = self.performance.now() - s
20+
})
1521
stream.on('data', chunk => {
1622
str += chunk
17-
stats.push(self.performance.now())
1823
})
1924
stream.on('end', () => {
20-
stats.push(self.performance.now())
21-
stats.forEach((val, index) => {
22-
const type = index !== stats.length - 1 ? 'Chunk' : 'Complete'
23-
console.log(type + ' time: ' + (val - self.s).toFixed(2) + 'ms')
24-
})
25+
complete = self.performance.now() - s
26+
console.log(`first chunk: ${first.toFixed(2)}ms`)
27+
console.log(`complete: ${complete.toFixed(2)}ms`)
2528
console.log()
2629
})

0 commit comments

Comments
 (0)