Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save some additional memory allocations #1

Conversation

nhunzaker
Copy link
Owner

No description provided.

@nhunzaker nhunzaker force-pushed the nh-fix-disabled-inputs-save-allocations branch from 1d8a89b to 8bf84ea Compare March 29, 2016 00:49
// Make sure we set .type before any other properties (setting .value
// before .type means .value is lost in IE11 and below)
type: undefined,
}, DisabledInputUtils.getNativeProps(inst, props), {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm keeping this { type: undefined } default for now, but is this relying on key insertion order? If not, could we replace this with something later like:

// Make sure we set .type, otherwise .value is lost in IE11 and below
nativeProps.type = nativeProps.type == null ? undefined: nativeProps;

If this isn't the case, we could save another allocation per input.

if (!props.disabled) {
return props;
assignWithNativeProps: function(a,b,c,d,e,f,g) {
invariant(!g, 'assignWithNativeProps only accepts 6 arguments');
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel awesome, but I wanted to lean on assign as before and didn't want to slice arguments into another allocation.

@nhunzaker nhunzaker force-pushed the nh-fix-disabled-inputs-save-allocations branch from 8bf84ea to 6e97642 Compare March 29, 2016 00:59
@nhunzaker nhunzaker closed this Mar 29, 2016
nhunzaker pushed a commit that referenced this pull request Jul 15, 2016
Improve symbol check for (local) polyfills
nhunzaker pushed a commit that referenced this pull request Aug 10, 2017
* Remove PooledClass from FallbackCompositionState

The only module that uses FallbackCompositonState is BeforeInputEventPlugin. The way its structured means there can only be a single instance of FallbackCompositionState at any given time (stored in a local variable at the top-level) so we don't really need pooling here at all. Instead, a single object is now stored in FallbackCompositionState, and access (initializing, reseting, getting data) is gaurded by the exported helper object.

* Use new FallbackCompositionState API in BeforeInputEventPlugin

* Implement event-specific pooling in SyntheticEvent

* Remove PooledClass from TopLevelCallbackBookKeeping

* Update results.json

* Add pooled event test fixtures (#1)

* Fix fixture lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant