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 b5978a7 commit 654fb1a
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 @@ -98,7 +98,6 @@
"is-language-code": "^2.0.0",
"isbinaryfile": "^4.0.6",
"js-yaml": "^3.14.0",
"json-stable-stringify": "^1.0.1",
"leek": "0.0.24",
"lodash.template": "^4.5.0",
"markdown-it": "^12.0.4",
Expand All @@ -114,6 +113,7 @@
"quick-temp": "^0.1.8",
"resolve": "^1.20.0",
"resolve-package-path": "^3.1.0",
"safe-stable-stringify": "^2.2.0",
"sane": "^5.0.1",
"semver": "^7.3.4",
"silent-error": "^1.1.1",
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 @@ -6940,6 +6940,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", "safer-buffer@>= 2.1.2 < 3.0.0":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
Expand Down

0 comments on commit 654fb1a

Please sign in to comment.