improve performance of safeParse #81
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
before:
JSON.parse x 1,711,391 ops/sec ±0.86% (87 runs sampled)
JSON.parse proto x 1,077,100 ops/sec ±1.18% (90 runs sampled)
secure-json-parse parse x 1,430,832 ops/sec ±1.00% (91 runs sampled)
secure-json-parse parse proto x 1,576,912 ops/sec ±1.14% (84 runs sampled)
secure-json-parse safeParse x 1,420,410 ops/sec ±1.06% (87 runs sampled)
secure-json-parse safeParse proto x 139,151 ops/sec ±0.97% (90 runs sampled)
JSON.parse reviver x 497,298 ops/sec ±0.83% (90 runs sampled)
after:
JSON.parse x 1,738,271 ops/sec ±0.84% (88 runs sampled)
JSON.parse proto x 1,100,147 ops/sec ±1.23% (89 runs sampled)
secure-json-parse parse x 1,441,809 ops/sec ±0.79% (91 runs sampled)
secure-json-parse parse proto x 1,592,567 ops/sec ±0.82% (82 runs sampled)
secure-json-parse safeParse x 1,405,980 ops/sec ±1.30% (90 runs sampled)
secure-json-parse safeParse proto x 917,157 ops/sec ±0.81% (92 runs sampled)
JSON.parse reviver x 501,752 ops/sec ±0.78% (88 runs sampled)
Checklist
npm run test
andnpm run benchmark
and the Code of conduct