Use mergeFast in a hotspot

Summary:
In profiling our app, we found that the usage
of `merge` in `Text.js` was showing up as a
hotspot. We've replaced this usage of `merge`
with `mergeFast`.

**Test plan (required)**

This change is used in my team's app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9654

Differential Revision: D3801791

fbshipit-source-id: 004652ed6537b557d00541ab2e5fbe64b56fa73b
This commit is contained in:
Adam Comella 2016-08-31 17:26:51 -07:00 committed by Facebook Github Bot 7
parent 17205aac57
commit 5d7227a822
1 changed files with 4 additions and 3 deletions

View File

@ -22,11 +22,12 @@ const Touchable = require('Touchable');
const createReactNativeComponentClass =
require('react/lib/createReactNativeComponentClass');
const merge = require('merge');
const mergeFast = require('mergeFast');
const stylePropType = StyleSheetPropType(TextStylePropTypes);
const viewConfig = {
validAttributes: merge(ReactNativeViewAttributes.UIView, {
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
numberOfLines: true,
ellipsizeMode: true,
@ -189,7 +190,7 @@ const Text = React.createClass({
};
},
getInitialState: function(): Object {
return merge(Touchable.Mixin.touchableGetInitialState(), {
return mergeFast(Touchable.Mixin.touchableGetInitialState(), {
isHighlighted: false,
});
},
@ -334,7 +335,7 @@ var RCTVirtualText = RCTText;
if (Platform.OS === 'android') {
RCTVirtualText = createReactNativeComponentClass({
validAttributes: merge(ReactNativeViewAttributes.UIView, {
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
}),
uiViewClassName: 'RCTVirtualText',