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

chore: replace json-stable-stringify with safe-stable-stringify #104

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

BridgeAR
Copy link
Contributor

This is a performance improvement as the latter is actually faster.

json-stable-stringify x 13,870 ops/sec ±0.72% (94 runs sampled)
safe-stable-stringify x 30,367 ops/sec ±0.39% (96 runs sampled)

The only difference is that objects with circular reference are from
now on also accepted instead of throwing an error.

@BridgeAR BridgeAR requested a review from a team as a code owner October 31, 2021 12:55
@BridgeAR BridgeAR changed the title chore: replace fast-stable-stringify with safe-stable-stringify chore: replace json-stable-stringify with safe-stable-stringify Oct 31, 2021
@BridgeAR BridgeAR force-pushed the switch-to-safe-stable-stringify branch from d7a037a to 87cedb9 Compare October 31, 2021 13:28
@rekmarks
Copy link
Member

rekmarks commented Nov 5, 2021

Thank you for your contribution! This needs to be rebased, but in any event, I don't believe that we want to accept circular references in any way. Would you be willing to add that as a feature to safe-stable-stringify?

@BridgeAR BridgeAR force-pushed the switch-to-safe-stable-stringify branch from 87cedb9 to 12cd897 Compare November 29, 2021 02:08
@BridgeAR
Copy link
Contributor Author

@rekmarks thanks for the feedback. I went ahead and implemented such option and updated the PR accordingly.

@Gudahtt
Copy link
Member

Gudahtt commented Feb 10, 2023

Hey @BridgeAR , sorry for the delay! I can review this again once the conflicts are resolved

@BridgeAR BridgeAR force-pushed the switch-to-safe-stable-stringify branch from 12cd897 to 023b289 Compare February 10, 2023 21:41
@BridgeAR
Copy link
Contributor Author

@Gudahtt thanks, I just rebased the PR.

This is a performance improvement as the latter is actually faster.

json-stable-stringify x 13,870 ops/sec ±0.72% (94 runs sampled)
safe-stable-stringify x 30,367 ops/sec ±0.39% (96 runs sampled)
@BridgeAR BridgeAR force-pushed the switch-to-safe-stable-stringify branch from 023b289 to 77dac8a Compare February 10, 2023 22:24
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@Gudahtt Gudahtt merged commit 18306a4 into MetaMask:main Feb 10, 2023
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.

3 participants