Skip to content

Commit

Permalink
[perf] Measure exclusive render time
Browse files Browse the repository at this point in the history
Piece of #962
  • Loading branch information
petehunt authored and zpao committed Feb 12, 2014
1 parent da587b1 commit 756bd97
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/core/ReactCompositeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -1267,25 +1267,29 @@ var ReactCompositeComponentMixin = {
/**
* @private
*/
_renderValidatedComponent: function() {
var renderedComponent;
var previousContext = ReactContext.current;
ReactContext.current = this._processChildContext(this._currentContext);
ReactCurrentOwner.current = this;
try {
renderedComponent = this.render();
} finally {
ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
_renderValidatedComponent: ReactPerf.measure(
'ReactCompositeComponent',
'_renderValidatedComponent',
function() {
var renderedComponent;
var previousContext = ReactContext.current;
ReactContext.current = this._processChildContext(this._currentContext);
ReactCurrentOwner.current = this;
try {
renderedComponent = this.render();
} finally {
ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
}
invariant(
ReactComponent.isValidComponent(renderedComponent),
'%s.render(): A valid ReactComponent must be returned. You may have ' +
'returned null, undefined, an array, or some other invalid object.',
this.constructor.displayName || 'ReactCompositeComponent'
);
return renderedComponent;
}
invariant(
ReactComponent.isValidComponent(renderedComponent),
'%s.render(): A valid ReactComponent must be returned. You may have ' +
'returned null, undefined, an array, or some other invalid object.',
this.constructor.displayName || 'ReactCompositeComponent'
);
return renderedComponent;
},
),

/**
* @private
Expand Down

0 comments on commit 756bd97

Please sign in to comment.