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

Add optional argument isDeep to File.clone #29

Closed
wants to merge 1 commit into from

Conversation

c0
Copy link

@c0 c0 commented Aug 7, 2014

  • Allows passing in isDeep:false to perform a shallow clone.

- Allows passing in isDeep:false to perform a shallow clone.
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling db7e066 on c0:optional_shallow_clone into 44ef836 on wearefractal:master.

@yocontra
Copy link
Member

yocontra commented Aug 7, 2014

Also related #16 and #9

@c0
Copy link
Author

c0 commented Aug 8, 2014

To put this in context, cloneDeep can have a negative performance impact as seen in amd-optimize (build went from 18s to 90s). It was bypassed there, but other repos may be affected.

I left cloneDeep true by default to maintain the current API, but it is worth to consider making it shallow by default.

@yocontra
Copy link
Member

yocontra commented Aug 8, 2014

@c0 Wow 15s to clone a file? That seems insane. We might have other problems if that's the case - we may want to look at using a new method of cloning that's closer to the metal

https://github.com/AlexeyKupershtokh/node-v8-clone

@popomore
Copy link
Contributor

I think it's necessary to set this argument. One for performance, the other some customObj don't want to be deep cloned

file.customObj = {};
var clonedFile = file.clone();
clonedFile.customObj === file.customObj; // should be true

popomore added a commit to popomore/vinyl that referenced this pull request Aug 28, 2014
popomore added a commit to popomore/vinyl that referenced this pull request Aug 28, 2014
popomore added a commit to popomore/vinyl that referenced this pull request Aug 28, 2014
popomore added a commit to popomore/vinyl that referenced this pull request Aug 28, 2014
@yocontra
Copy link
Member

Fixed by #32

@yocontra yocontra closed this Aug 29, 2014
phated pushed a commit that referenced this pull request Sep 27, 2016
phated pushed a commit that referenced this pull request Sep 27, 2016
phated pushed a commit that referenced this pull request Sep 27, 2016
phated pushed a commit that referenced this pull request Sep 27, 2016
phated pushed a commit that referenced this pull request Sep 27, 2016
phated pushed a commit that referenced this pull request Sep 27, 2016
phated pushed a commit that referenced this pull request Sep 27, 2016
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.

4 participants