Skip to content

Commit

Permalink
chore: replace json-stable-stringify with safe-stable-stringify
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BridgeAR committed Oct 31, 2021
1 parent f1cf56b commit 31d8a67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -97,7 +97,7 @@
"is-git-url": "^1.0.0",
"isbinaryfile": "^3.0.3",
"js-yaml": "^3.13.1",
"json-stable-stringify": "^1.0.1",
"safe-stable-stringify": "^2.2.0",
"leek": "0.0.24",
"lodash.template": "^4.5.0",
"markdown-it": "^9.1.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/package-cache.js
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
const quickTemp = require('quick-temp');
const Configstore = require('configstore');
const CommandGenerator = require('./command-generator');
const stableStringify = require('json-stable-stringify');
const stableStringify = require('safe-stable-stringify');
const symlinkOrCopySync = require('symlink-or-copy').sync;

let originalWorkingDirectory = process.cwd();
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Expand Up @@ -5534,6 +5534,11 @@ safe-regex@^1.1.0:
dependencies:
ret "~0.1.10"

safe-stable-stringify@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.2.0.tgz#26a52f13a6988de16a0d88e20248f38e8a7d840c"
integrity sha512-C6AuMdYPuPV/P1leplHNu0lgc2LAElq/g3TdoksDCIVtBhr78o/CH03bt/9SKqugFbKU9CUjsNlCu0fjtQzQUw==

"safer-buffer@>= 2.1.2 < 3":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
Expand Down

0 comments on commit 31d8a67

Please sign in to comment.