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:
parent
17205aac57
commit
5d7227a822
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue