Skip to content

Conversation

@marcelltoth
Copy link

As the title says.

Unfortunately the library currently relies heavily on deep cloning, which takes up the bulk of the run-time.

This PR replaces the original deep-clone implementation (lodash'sh cloneDeep) with fast-copy. This tiny change alone makes JST run 20% faster on the stress test schema, which is fascinating. (And an indication of how inefficient this lib is.)

@marcelltoth marcelltoth added the enhancement New feature or request label Mar 18, 2021
@marcelltoth marcelltoth requested a review from P0lip March 18, 2021 09:28
@marcelltoth marcelltoth self-assigned this Mar 18, 2021
Copy link

@P0lip P0lip left a comment

Choose a reason for hiding this comment

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

👍

and yeah, if I am not mistaken _.cloneDeep was never quite meant to be efficient.
The primary use case was to be able to clone a number of different data structures, and this is where cloneDeep shines.

I'll add this to my TODO list. I'll try to get rid of deep cloning entirely, as this is useless if you combine it with deep flag.

@P0lip P0lip merged commit 156c7e2 into master Mar 18, 2021
@P0lip P0lip deleted the feat/fast-copy branch March 18, 2021 09:31
P0lip pushed a commit that referenced this pull request Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants