Socket
Socket
Sign inDemoInstall

fast-redact

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-redact - npm Package Compare versions

Comparing version 1.1.12 to 1.1.13

14

benchmark/index.js

@@ -12,2 +12,4 @@ 'use strict'

const redactIntermediateWild = fastRedact({paths: ['a.*.c']})
const redactIntermediateWildMatchWildOutcome = fastRedact({paths: ['a.*.c', 'a.*.b', 'a.*.a']})
const redactStaticMatchWildOutcome = fastRedact({paths: ['a.b.c', 'a.d.a', 'a.d.b', 'a.d.c']})

@@ -118,2 +120,14 @@ const obj = {

setImmediate(cb)
},
function benchFastRedactIntermediateWildMatchWildOutcomeSerialize (cb) {
for (var i = 0; i < max; i++) {
redactIntermediateWildMatchWildOutcome(obj)
}
setImmediate(cb)
},
function benchFastRedactStaticMatchWildOutcomeSerialize (cb) {
for (var i = 0; i < max; i++) {
redactStaticMatchWildOutcome(obj)
}
setImmediate(cb)
}

@@ -120,0 +134,0 @@ ], 500)

2

package.json
{
"name": "fast-redact",
"version": "1.1.12",
"version": "1.1.13",
"description": "very fast object redaction",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -194,12 +194,16 @@ # fast-redact

In the direct calling case, `fast-redact` is over 25x faster than `pino-noir`, however a more realistic
In the direct calling case, `fast-redact` is ~30x faster than `pino-noir`, however a more realistic
comparison is overhead on `JSON.stringify`.
For a static redaction case (no wildcards) `pino-noir` adds ~28% overhead on top of `JSON.stringify`
whereas `fast-redact` adds ~2% overhead.
For a static redaction case (no wildcards) `pino-noir` adds ~25% overhead on top of `JSON.stringify`
whereas `fast-redact` adds ~1% overhead.
In the basic last-position wildcard case,`fast-redact` is ~5% faster than `pino-noir`, and
intermediate wildcard redaction (which `pino-noir` does not support) is still faster than
the `pino-noir` basic wildcard case.
In the basic last-position wildcard case,`fast-redact` is ~12% faster than `pino-noir`.
The `pino-noir` module does not support intermediate wildcards, but `fast-redact` does,
the cost of an intermediate wildcard that results in two keys over two nested objects
being redacted is about 25% overhead on `JSON.stringify`. The cost of an intermediate
wildcard that results in four keys across two objects being redacted is about 55% overhead
on `JSON.stringify` and ~50% more expensive that explicitly declaring the keys.
```sh

@@ -210,16 +214,18 @@ npm run bench

```
benchNoirV2*500: 52.387ms
benchFastRedact*500: 2.361ms
benchFastRedactRestore*500: 13.715ms
benchNoirV2Wild*500: 75.820ms
benchFastRedactWild*500: 29.813ms
benchFastRedactWildRestore*500: 36.182ms
benchFastRedactIntermediateWild*500: 185.323ms
benchFastRedactIntermediateWildRestore*500: 73.520ms
benchJSONStringify*500: 268.861ms
benchNoirV2Serialize*500: 372.731ms
benchFastRedactSerialize*500: 273.265ms
benchNoirV2WildSerialize*500: 330.679ms
benchFastRedactWildSerialize*500: 312.374ms
benchFastRedactIntermediateWildSerialize*500: 325.921ms
benchNoirV2*500: 59.108ms
benchFastRedact*500: 2.483ms
benchFastRedactRestore*500: 10.904ms
benchNoirV2Wild*500: 91.399ms
benchFastRedactWild*500: 21.200ms
benchFastRedactWildRestore*500: 27.304ms
benchFastRedactIntermediateWild*500: 92.304ms
benchFastRedactIntermediateWildRestore*500: 107.047ms
benchJSONStringify*500: 210.573ms
benchNoirV2Serialize*500: 281.148ms
benchFastRedactSerialize*500: 215.845ms
benchNoirV2WildSerialize*500: 281.168ms
benchFastRedactWildSerialize*500: 247.140ms
benchFastRedactIntermediateWildSerialize*500: 333.722ms
benchFastRedactIntermediateWildMatchWildOutcomeSerialize*500: 463.667ms
benchFastRedactStaticMatchWildOutcomeSerialize*500: 239.293ms
```

@@ -234,3 +240,3 @@

```
197 passing (455.646ms)
199 passing (453.186ms)
```

@@ -237,0 +243,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc