From 98671fda1aa89b7bb931db3c6ecffa263984c706 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Fri, 13 Mar 2015 18:51:53 -0700 Subject: [PATCH] Fix up Perf a bit better for 0.13 _mountImageIntoNode moved into ReactMount and wasn't being counted where it was supposed to be. In addition, all DOM elements are now wrapped in a composite wrapper but for the perf tools we want to skip over those or else we'll double-count (at least with the current accounting -- and that's effectively what we did before so this brings us back up to parity). Fixes #3407. Test Plan: Used the jsbin from #3407 and saw similar output from this branch and 0.12: ![image](https://cloud.githubusercontent.com/assets/6820/6649816/4d7202e0-c9b2-11e4-9364-e1b50c96b55b.png) --- src/test/ReactDefaultPerf.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/ReactDefaultPerf.js b/src/test/ReactDefaultPerf.js index b51820cdc7..26fe2cee16 100644 --- a/src/test/ReactDefaultPerf.js +++ b/src/test/ReactDefaultPerf.js @@ -163,8 +163,8 @@ var ReactDefaultPerf = { ReactDefaultPerf._allMeasurements.length - 1 ].totalTime = performanceNow() - start; return rv; - } else if (moduleName === 'ReactDOMIDOperations' || - moduleName === 'ReactComponentBrowserEnvironment') { + } else if (fnName === '_mountImageIntoNode' || + moduleName === 'ReactDOMIDOperations') { start = performanceNow(); rv = func.apply(this, args); totalTime = performanceNow() - start; @@ -210,6 +210,10 @@ var ReactDefaultPerf = { fnName === 'updateComponent' || // TODO: receiveComponent()? fnName === '_renderValidatedComponent')) { + if (typeof this._currentElement.type === 'string') { + return func.apply(this, args); + } + var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID; @@ -243,9 +247,7 @@ var ReactDefaultPerf = { } entry.displayNames[rootNodeID] = { - current: typeof this._currentElement.type === 'string' ? - this._currentElement.type : - this.getName(), + current: this.getName(), owner: this._currentElement._owner ? this._currentElement._owner.getName() : ''