File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,21 @@ const EMPTY_ARR = [];
4747function renderToString ( vnode , context , opts ) {
4848 context = context || { } ;
4949 opts = opts || { } ;
50+
51+ // Performance optimization: `renderToString` is synchronous and we
52+ // therefore don't execute any effects. To do that we pass an empty
53+ // array to `options._commit` (`__c`). But we can go one step further
54+ // and avoid a lot of dirty checks and allocations by setting
55+ // `options._skipEffects` (`__s`) too.
56+ const previousSkipEffects = options . __s ;
57+ options . __s = true ;
58+
5059 const res = _renderToString ( vnode , context , opts ) ;
60+
5161 // options._commit, we don't schedule any effects in this library right now,
5262 // so we can pass an empty queue to this hook.
5363 if ( options . __c ) options . __c ( vnode , EMPTY_ARR ) ;
64+ options . __s = previousSkipEffects ;
5465 return res ;
5566}
5667
You can’t perform that action at this time.
0 commit comments