File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 1+ /* eslint-disable no-unused-vars */
2+
13'use strict'
24
35const Vue = require ( '../../dist/vue.runtime.common.js' )
@@ -7,20 +9,21 @@ const gridComponent = require('./common.js')
79
810console . log ( '--- renderToStream --- ' )
911const self = ( global || root )
10- self . s = self . performance . now ( )
12+ const s = self . performance . now ( )
1113
1214const stream = renderToStream ( new Vue ( gridComponent ) )
1315let str = ''
14- const stats = [ ]
16+ let first
17+ let complete
18+ stream . once ( 'data' , ( ) => {
19+ first = self . performance . now ( ) - s
20+ } )
1521stream . on ( 'data' , chunk => {
1622 str += chunk
17- stats . push ( self . performance . now ( ) )
1823} )
1924stream . 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} )
You can’t perform that action at this time.
0 commit comments