Skip to content

Add optional argument isDeep to File.clone#29

Closed
c0 wants to merge 1 commit intogulpjs:masterfrom
c0:optional_shallow_clone
Closed

Add optional argument isDeep to File.clone#29
c0 wants to merge 1 commit intogulpjs:masterfrom
c0:optional_shallow_clone

Conversation

@c0
Copy link
Copy Markdown

@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
Copy Markdown

Coverage Status

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

@yocontra
Copy link
Copy Markdown
Member

yocontra commented Aug 7, 2014

Also related #16 and #9

@c0
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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