-
Notifications
You must be signed in to change notification settings - Fork 30k
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
util: harden more built-in classes against prototype pollution #56225
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #56225 +/- ##
========================================
Coverage 88.53% 88.53%
========================================
Files 657 657
Lines 189880 190225 +345
Branches 36453 36529 +76
========================================
+ Hits 168104 168420 +316
+ Misses 14988 14985 -3
- Partials 6788 6820 +32
|
@@ -599,8 +608,13 @@ function isInstanceof(object, proto) { | |||
|
|||
// Special-case for some builtin prototypes in case their `constructor` property has been tampered. | |||
const wellKnownPrototypes = new SafeMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const wellKnownPrototypes = new SafeMap(); | |
const wellKnownPrototypes = new SafeWeakMap(); |
not sure if this affects performance or not - since the builtins aren't expected to be collected it probably doesn't matter either way, so stick with whatever's faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1656/
I know this is not a performance PR, but as we saw in the other PR, this approach really helped performance, so I ran this benchmark just to check for any regressions/improvements.
Results
confidence improvement accuracy (*) (**) (***)
util/format.js type='many-%' n=1000000 -0.22 % ±0.73% ±0.97% ±1.26%
util/format.js type='no-replace-2' n=1000000 -0.93 % ±1.74% ±2.32% ±3.02%
util/format.js type='no-replace' n=1000000 0.29 % ±1.12% ±1.50% ±1.95%
util/format.js type='number' n=1000000 0.71 % ±1.15% ±1.53% ±2.00%
util/format.js type='object-%s' n=1000000 -0.05 % ±0.33% ±0.44% ±0.57%
util/format.js type='object-to-string' n=1000000 0.30 % ±1.32% ±1.75% ±2.28%
util/format.js type='only-objects' n=1000000 0.17 % ±0.26% ±0.34% ±0.45%
util/format.js type='replace-object' n=1000000 -0.45 % ±0.61% ±0.81% ±1.06%
util/format.js type='string-2' n=1000000 -0.10 % ±1.36% ±1.81% ±2.36%
util/format.js type='string' n=1000000 -0.16 % ±1.25% ±1.67% ±2.18%
util/format.js type='unknown' n=1000000 -0.16 % ±1.21% ±1.61% ±2.10%
util/get-callsite.js method='CPP' n=1000000 * -0.39 % ±0.37% ±0.49% ±0.65%
util/get-callsite.js method='ErrorCallSites' n=1000000 -0.01 % ±0.26% ±0.35% ±0.46%
util/get-callsite.js method='ErrorCallSitesSerialized' n=1000000 0.10 % ±0.18% ±0.23% ±0.30%
util/inspect-array.js type='denseArray_showHidden' len=100 n=5000 * 0.69 % ±0.66% ±0.88% ±1.15%
util/inspect-array.js type='denseArray_showHidden' len=100000 n=5000 * 1.22 % ±0.99% ±1.31% ±1.71%
util/inspect-array.js type='denseArray' len=100 n=5000 0.10 % ±0.64% ±0.86% ±1.12%
util/inspect-array.js type='denseArray' len=100000 n=5000 * 1.24 % ±0.98% ±1.31% ±1.70%
util/inspect-array.js type='mixedArray' len=100 n=5000 0.17 % ±0.32% ±0.43% ±0.56%
util/inspect-array.js type='mixedArray' len=100000 n=5000 0.09 % ±0.13% ±0.18% ±0.23%
util/inspect-array.js type='sparseArray' len=100 n=5000 3.21 % ±4.26% ±5.67% ±7.38%
util/inspect-array.js type='sparseArray' len=100000 n=5000 -0.10 % ±0.81% ±1.08% ±1.40%
util/inspect-proxy.js isProxy=0 showProxy=0 n=100000 ** -0.70 % ±0.50% ±0.66% ±0.86%
util/inspect-proxy.js isProxy=0 showProxy=1 n=100000 0.07 % ±0.70% ±0.93% ±1.21%
util/inspect-proxy.js isProxy=1 showProxy=0 n=100000 -0.12 % ±0.56% ±0.74% ±0.97%
util/inspect-proxy.js isProxy=1 showProxy=1 n=100000 -0.30 % ±0.43% ±0.57% ±0.74%
util/inspect.js option='colors' method='Array' n=80000 *** 1.83 % ±0.46% ±0.61% ±0.79%
util/inspect.js option='colors' method='Date' n=80000 -0.07 % ±1.15% ±1.53% ±1.99%
util/inspect.js option='colors' method='Error' n=80000 -0.59 % ±0.77% ±1.03% ±1.34%
util/inspect.js option='colors' method='Number' n=80000 0.05 % ±2.36% ±3.14% ±4.10%
util/inspect.js option='colors' method='Object_deep_ln' n=80000 -0.01 % ±0.27% ±0.36% ±0.46%
util/inspect.js option='colors' method='Object_empty' n=80000 0.09 % ±2.23% ±2.96% ±3.85%
util/inspect.js option='colors' method='Object' n=80000 -0.05 % ±0.46% ±0.61% ±0.79%
util/inspect.js option='colors' method='Set' n=80000 *** 5.38 % ±0.87% ±1.16% ±1.51%
util/inspect.js option='colors' method='String_boxed' n=80000 1.30 % ±1.64% ±2.18% ±2.84%
util/inspect.js option='colors' method='String_complex' n=80000 1.37 % ±1.43% ±1.91% ±2.50%
util/inspect.js option='colors' method='String' n=80000 1.45 % ±1.91% ±2.56% ±3.37%
util/inspect.js option='colors' method='TypedArray_extra' n=80000 0.24 % ±0.34% ±0.45% ±0.59%
util/inspect.js option='colors' method='TypedArray' n=80000 0.09 % ±0.43% ±0.58% ±0.75%
util/inspect.js option='none' method='Array' n=80000 0.12 % ±0.58% ±0.77% ±1.00%
util/inspect.js option='none' method='Date' n=80000 -1.05 % ±1.61% ±2.15% ±2.80%
util/inspect.js option='none' method='Error' n=80000 -1.56 % ±1.84% ±2.46% ±3.23%
util/inspect.js option='none' method='Number' n=80000 0.90 % ±2.44% ±3.26% ±4.26%
util/inspect.js option='none' method='Object_deep_ln' n=80000 0.37 % ±0.47% ±0.62% ±0.81%
util/inspect.js option='none' method='Object_empty' n=80000 1.23 % ±2.18% ±2.90% ±3.78%
util/inspect.js option='none' method='Object' n=80000 -0.50 % ±0.99% ±1.32% ±1.71%
util/inspect.js option='none' method='Set' n=80000 *** 11.52 % ±1.60% ±2.13% ±2.77%
util/inspect.js option='none' method='String_boxed' n=80000 -0.11 % ±0.54% ±0.72% ±0.95%
util/inspect.js option='none' method='String_complex' n=80000 * 2.59 % ±2.38% ±3.17% ±4.13%
util/inspect.js option='none' method='String' n=80000 -0.04 % ±2.02% ±2.70% ±3.52%
util/inspect.js option='none' method='TypedArray_extra' n=80000 * -0.40 % ±0.37% ±0.49% ±0.64%
util/inspect.js option='none' method='TypedArray' n=80000 -0.09 % ±0.49% ±0.66% ±0.86%
util/inspect.js option='showHidden' method='Array' n=80000 ** 0.78 % ±0.47% ±0.63% ±0.82%
util/inspect.js option='showHidden' method='Date' n=80000 -0.92 % ±1.22% ±1.62% ±2.12%
util/inspect.js option='showHidden' method='Error' n=80000 -0.03 % ±0.77% ±1.03% ±1.34%
util/inspect.js option='showHidden' method='Number' n=80000 -0.86 % ±3.93% ±5.23% ±6.81%
util/inspect.js option='showHidden' method='Object_deep_ln' n=80000 * -0.41 % ±0.33% ±0.44% ±0.57%
util/inspect.js option='showHidden' method='Object_empty' n=80000 -0.22 % ±3.23% ±4.30% ±5.60%
util/inspect.js option='showHidden' method='Object' n=80000 -0.11 % ±0.57% ±0.76% ±0.99%
util/inspect.js option='showHidden' method='Set' n=80000 *** 13.13 % ±1.49% ±1.98% ±2.59%
util/inspect.js option='showHidden' method='String_boxed' n=80000 -0.17 % ±0.63% ±0.84% ±1.10%
util/inspect.js option='showHidden' method='String_complex' n=80000 0.74 % ±1.43% ±1.90% ±2.47%
util/inspect.js option='showHidden' method='String' n=80000 -1.17 % ±4.61% ±6.14% ±7.99%
util/inspect.js option='showHidden' method='TypedArray_extra' n=80000 *** 3.95 % ±0.38% ±0.51% ±0.67%
util/inspect.js option='showHidden' method='TypedArray' n=80000 *** 3.69 % ±0.54% ±0.71% ±0.93%
util/normalize-encoding.js n=1000000 input='' 4.37 % ±4.58% ±6.10% ±7.94%
util/normalize-encoding.js n=1000000 input='base64' 0.96 % ±4.65% ±6.19% ±8.06%
util/normalize-encoding.js n=1000000 input='BASE64' -2.61 % ±3.73% ±4.97% ±6.48%
util/normalize-encoding.js n=1000000 input='binary' 0.72 % ±3.81% ±5.06% ±6.60%
util/normalize-encoding.js n=1000000 input='BINARY' 0.63 % ±2.88% ±3.83% ±4.98%
util/normalize-encoding.js n=1000000 input='foo' 1.20 % ±2.51% ±3.34% ±4.36%
util/normalize-encoding.js n=1000000 input='group_common' * 1.60 % ±1.41% ±1.89% ±2.48%
util/normalize-encoding.js n=1000000 input='group_misc' -0.38 % ±3.52% ±4.69% ±6.11%
util/normalize-encoding.js n=1000000 input='group_uncommon' -0.32 % ±5.09% ±6.77% ±8.81%
util/normalize-encoding.js n=1000000 input='group_upper' -0.84 % ±3.19% ±4.25% ±5.54%
util/normalize-encoding.js n=1000000 input='hex' 0.96 % ±5.34% ±7.10% ±9.24%
util/normalize-encoding.js n=1000000 input='HEX' 1.12 % ±4.72% ±6.28% ±8.18%
util/normalize-encoding.js n=1000000 input='latin1' -0.81 % ±4.85% ±6.49% ±8.50%
util/normalize-encoding.js n=1000000 input='ucs2' -2.48 % ±4.26% ±5.67% ±7.39%
util/normalize-encoding.js n=1000000 input='UCS2' 1.60 % ±4.17% ±5.55% ±7.23%
util/normalize-encoding.js n=1000000 input='undefined' 0.26 % ±3.81% ±5.07% ±6.61%
util/normalize-encoding.js n=1000000 input='utf-8' -3.48 % ±3.89% ±5.20% ±6.83%
util/normalize-encoding.js n=1000000 input='UTF-8' 0.98 % ±2.94% ±3.91% ±5.09%
util/normalize-encoding.js n=1000000 input='utf16le' -1.13 % ±3.51% ±4.68% ±6.11%
util/normalize-encoding.js n=1000000 input='UTF16LE' 0.24 % ±5.25% ±6.98% ±9.10%
util/normalize-encoding.js n=1000000 input='utf8' -0.57 % ±4.34% ±5.78% ±7.52%
util/normalize-encoding.js n=1000000 input='Utf8' 0.88 % ±1.80% ±2.40% ±3.12%
util/normalize-encoding.js n=1000000 input='UTF8' 3.02 % ±5.53% ±7.37% ±9.61%
util/parse-env.js n=30000 0.25 % ±0.49% ±0.65% ±0.84%
util/priority-queue.js n=100000 * -1.79 % ±1.78% ±2.39% ±3.15%
util/splice-one.js size=10 pos='end' n=5000000 2.49 % ±3.64% ±4.85% ±6.33%
util/splice-one.js size=10 pos='middle' n=5000000 -0.32 % ±0.79% ±1.05% ±1.37%
util/splice-one.js size=10 pos='start' n=5000000 -0.60 % ±0.89% ±1.19% ±1.54%
util/splice-one.js size=100 pos='end' n=5000000 -1.15 % ±3.48% ±4.64% ±6.06%
util/splice-one.js size=100 pos='middle' n=5000000 0.29 % ±0.56% ±0.75% ±0.97%
util/splice-one.js size=100 pos='start' n=5000000 -0.01 % ±0.17% ±0.22% ±0.29%
util/splice-one.js size=500 pos='end' n=5000000 -0.19 % ±4.29% ±5.71% ±7.43%
util/splice-one.js size=500 pos='middle' n=5000000 0.01 % ±0.06% ±0.08% ±0.10%
util/splice-one.js size=500 pos='start' n=5000000 -0.01 % ±0.02% ±0.03% ±0.03%
util/style-text.js n=1000 format='invalid' messageType='boolean' -3.08 % ±3.16% ±4.24% ±5.60%
util/style-text.js n=1000 format='invalid' messageType='invalid' -1.20 % ±2.55% ±3.40% ±4.42%
util/style-text.js n=1000 format='invalid' messageType='number' 2.62 % ±4.36% ±5.84% ±7.67%
util/style-text.js n=1000 format='invalid' messageType='string' -1.28 % ±4.49% ±5.98% ±7.78%
util/style-text.js n=1000 format='italic' messageType='boolean' -0.17 % ±2.61% ±3.47% ±4.52%
util/style-text.js n=1000 format='italic' messageType='invalid' 1.65 % ±2.13% ±2.85% ±3.75%
util/style-text.js n=1000 format='italic' messageType='number' 0.83 % ±2.46% ±3.29% ±4.31%
util/style-text.js n=1000 format='italic' messageType='string' 2.10 % ±2.57% ±3.43% ±4.47%
util/style-text.js n=1000 format='red' messageType='boolean' 0.64 % ±2.18% ±2.90% ±3.77%
util/style-text.js n=1000 format='red' messageType='invalid' 0.90 % ±3.03% ±4.03% ±5.24%
util/style-text.js n=1000 format='red' messageType='number' * -2.03 % ±1.94% ±2.60% ±3.40%
util/style-text.js n=1000 format='red' messageType='string' -1.05 % ±3.00% ±3.99% ±5.19%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=0 encoding='iso-8859-3' 0.08 % ±0.83% ±1.11% ±1.44%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=0 encoding='utf-8' -1.57 % ±1.85% ±2.48% ±3.25%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=0 encoding='windows-1252' 0.60 % ±1.81% ±2.41% ±3.13%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=1 encoding='iso-8859-3' -0.10 % ±1.09% ±1.44% ±1.88%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=1 encoding='utf-8' 0.38 % ±1.27% ±1.69% ±2.20%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=1 encoding='windows-1252' -0.24 % ±1.50% ±2.00% ±2.61%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=0 encoding='iso-8859-3' -0.65 % ±1.03% ±1.37% ±1.78%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=0 encoding='utf-8' 1.18 % ±1.49% ±1.98% ±2.59%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=0 encoding='windows-1252' * -1.63 % ±1.55% ±2.07% ±2.73%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=1 encoding='iso-8859-3' 0.17 % ±0.96% ±1.28% ±1.66%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=1 encoding='utf-8' 0.51 % ±1.82% ±2.43% ±3.16%
util/text-decoder.js type='ArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=1 encoding='windows-1252' 0.69 % ±1.62% ±2.15% ±2.80%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=0 encoding='iso-8859-3' * -1.86 % ±1.68% ±2.24% ±2.93%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=0 encoding='utf-8' 0.01 % ±1.81% ±2.41% ±3.15%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=0 encoding='windows-1252' 0.25 % ±1.42% ±1.88% ±2.45%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=1 encoding='iso-8859-3' -0.90 % ±3.46% ±4.60% ±5.99%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=1 encoding='utf-8' 2.24 % ±2.40% ±3.19% ±4.16%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=1 encoding='windows-1252' 0.42 % ±1.94% ±2.59% ±3.37%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=0 encoding='iso-8859-3' -0.86 % ±3.01% ±4.01% ±5.22%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=0 encoding='utf-8' 0.03 % ±2.49% ±3.34% ±4.38%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=0 encoding='windows-1252' 0.46 % ±2.32% ±3.09% ±4.03%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=1 encoding='iso-8859-3' -1.88 % ±3.45% ±4.59% ±5.98%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=1 encoding='utf-8' -1.00 % ±3.11% ±4.15% ±5.43%
util/text-decoder.js type='ArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=1 encoding='windows-1252' -0.33 % ±1.28% ±1.70% ±2.21%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=0 encoding='iso-8859-3' -0.08 % ±3.54% ±4.71% ±6.13%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=0 encoding='utf-8' 1.08 % ±4.71% ±6.28% ±8.19%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=0 encoding='windows-1252' 1.19 % ±3.21% ±4.27% ±5.56%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=1 encoding='iso-8859-3' 0.79 % ±3.48% ±4.64% ±6.04%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=1 encoding='utf-8' 1.20 % ±3.44% ±4.58% ±5.96%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=1 encoding='windows-1252' 1.27 % ±4.77% ±6.35% ±8.27%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=0 encoding='iso-8859-3' -0.32 % ±3.41% ±4.54% ±5.91%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=0 encoding='utf-8' 0.48 % ±4.32% ±5.75% ±7.49%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=0 encoding='windows-1252' 1.60 % ±4.47% ±5.95% ±7.75%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=1 encoding='iso-8859-3' 0.03 % ±4.11% ±5.47% ±7.12%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=1 encoding='utf-8' -4.26 % ±5.14% ±6.85% ±8.95%
util/text-decoder.js type='ArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=1 encoding='windows-1252' -1.81 % ±4.72% ±6.28% ±8.18%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=0 ignoreBOM=0 encoding='iso-8859-3' -0.65 % ±2.85% ±3.79% ±4.93%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=0 ignoreBOM=0 encoding='utf-8' -0.07 % ±1.12% ±1.49% ±1.94%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=0 ignoreBOM=0 encoding='windows-1252' -0.35 % ±2.09% ±2.78% ±3.62%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=0 ignoreBOM=1 encoding='iso-8859-3' -2.04 % ±2.13% ±2.85% ±3.76%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=0 ignoreBOM=1 encoding='utf-8' 0.36 % ±1.10% ±1.47% ±1.91%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=0 ignoreBOM=1 encoding='windows-1252' 1.39 % ±1.99% ±2.65% ±3.46%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=1 ignoreBOM=0 encoding='iso-8859-3' 2.16 % ±5.70% ±7.58% ±9.87%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=1 ignoreBOM=0 encoding='utf-8' -0.63 % ±4.59% ±6.11% ±7.96%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=1 ignoreBOM=0 encoding='windows-1252' -2.08 % ±2.14% ±2.84% ±3.71%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=1 ignoreBOM=1 encoding='iso-8859-3' -4.63 % ±5.60% ±7.45% ±9.71%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=1 ignoreBOM=1 encoding='utf-8' 2.78 % ±4.08% ±5.43% ±7.07%
util/text-decoder.js type='Buffer' n=1000 len=131072 fatal=1 ignoreBOM=1 encoding='windows-1252' 0.22 % ±2.57% ±3.43% ±4.48%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=0 ignoreBOM=0 encoding='iso-8859-3' -2.54 % ±7.64% ±10.17% ±13.24%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=0 ignoreBOM=0 encoding='utf-8' -2.76 % ±7.17% ±9.54% ±12.43%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=0 ignoreBOM=0 encoding='windows-1252' -1.76 % ±6.86% ±9.12% ±11.88%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=0 ignoreBOM=1 encoding='iso-8859-3' -2.74 % ±6.96% ±9.28% ±12.11%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=0 ignoreBOM=1 encoding='utf-8' 2.88 % ±7.31% ±9.73% ±12.66%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=0 ignoreBOM=1 encoding='windows-1252' -3.63 % ±5.76% ±7.66% ±9.97%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=1 ignoreBOM=0 encoding='iso-8859-3' 5.55 % ±5.73% ±7.65% ±10.00%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=1 ignoreBOM=0 encoding='utf-8' 0.04 % ±2.16% ±2.88% ±3.75%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=1 ignoreBOM=0 encoding='windows-1252' 1.08 % ±5.20% ±6.92% ±9.02%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=1 ignoreBOM=1 encoding='iso-8859-3' 0.50 % ±3.90% ±5.19% ±6.76%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=1 ignoreBOM=1 encoding='utf-8' 0.49 % ±1.89% ±2.53% ±3.31%
util/text-decoder.js type='Buffer' n=1000 len=16384 fatal=1 ignoreBOM=1 encoding='windows-1252' -4.49 % ±6.28% ±8.35% ±10.88%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=0 ignoreBOM=0 encoding='iso-8859-3' 0.62 % ±2.85% ±3.80% ±4.95%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=0 ignoreBOM=0 encoding='utf-8' 3.35 % ±3.45% ±4.59% ±5.99%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=0 ignoreBOM=0 encoding='windows-1252' -0.54 % ±2.50% ±3.33% ±4.33%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=0 ignoreBOM=1 encoding='iso-8859-3' 0.86 % ±2.55% ±3.39% ±4.41%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=0 ignoreBOM=1 encoding='utf-8' 0.48 % ±3.37% ±4.49% ±5.85%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=0 ignoreBOM=1 encoding='windows-1252' 1.71 % ±4.37% ±5.81% ±7.58%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=1 ignoreBOM=0 encoding='iso-8859-3' -1.36 % ±2.64% ±3.51% ±4.58%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=1 ignoreBOM=0 encoding='utf-8' 1.31 % ±4.04% ±5.38% ±7.01%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=1 ignoreBOM=0 encoding='windows-1252' 0.23 % ±3.43% ±4.58% ±5.98%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=1 ignoreBOM=1 encoding='iso-8859-3' -0.33 % ±2.14% ±2.85% ±3.72%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=1 ignoreBOM=1 encoding='utf-8' -0.89 % ±3.53% ±4.70% ±6.11%
util/text-decoder.js type='Buffer' n=1000 len=256 fatal=1 ignoreBOM=1 encoding='windows-1252' 0.66 % ±3.61% ±4.82% ±6.28%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=0 encoding='iso-8859-3' ** -1.52 % ±0.93% ±1.23% ±1.60%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=0 encoding='utf-8' -0.60 % ±2.23% ±2.97% ±3.87%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=0 encoding='windows-1252' -0.21 % ±2.05% ±2.73% ±3.56%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=1 encoding='iso-8859-3' -0.83 % ±1.02% ±1.35% ±1.76%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=1 encoding='utf-8' 0.38 % ±1.71% ±2.27% ±2.96%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=0 ignoreBOM=1 encoding='windows-1252' -0.48 % ±1.56% ±2.08% ±2.71%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=0 encoding='iso-8859-3' * -1.01 % ±0.91% ±1.22% ±1.58%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=0 encoding='utf-8' -0.19 % ±0.99% ±1.31% ±1.71%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=0 encoding='windows-1252' -1.32 % ±1.56% ±2.08% ±2.72%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=1 encoding='iso-8859-3' * -0.92 % ±0.84% ±1.11% ±1.45%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=1 encoding='utf-8' -0.21 % ±1.06% ±1.41% ±1.83%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=131072 fatal=1 ignoreBOM=1 encoding='windows-1252' -1.39 % ±1.71% ±2.28% ±2.98%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=0 encoding='iso-8859-3' 1.45 % ±1.99% ±2.66% ±3.47%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=0 encoding='utf-8' -0.13 % ±1.20% ±1.60% ±2.08%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=0 encoding='windows-1252' 0.16 % ±1.84% ±2.45% ±3.19%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=1 encoding='iso-8859-3' 0.48 % ±3.54% ±4.72% ±6.14%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=1 encoding='utf-8' -0.11 % ±1.75% ±2.33% ±3.03%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=0 ignoreBOM=1 encoding='windows-1252' 0.94 % ±1.89% ±2.51% ±3.27%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=0 encoding='iso-8859-3' * 3.83 % ±3.34% ±4.46% ±5.84%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=0 encoding='utf-8' -0.62 % ±1.67% ±2.22% ±2.89%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=0 encoding='windows-1252' 0.01 % ±1.56% ±2.07% ±2.70%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=1 encoding='iso-8859-3' 0.89 % ±3.55% ±4.72% ±6.14%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=1 encoding='utf-8' -1.55 % ±1.76% ±2.34% ±3.05%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=16384 fatal=1 ignoreBOM=1 encoding='windows-1252' -2.52 % ±2.71% ±3.63% ±4.77%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=0 encoding='iso-8859-3' -1.64 % ±7.23% ±9.62% ±12.53%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=0 encoding='utf-8' 1.88 % ±4.70% ±6.25% ±8.13%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=0 encoding='windows-1252' 0.52 % ±5.47% ±7.28% ±9.47%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=1 encoding='iso-8859-3' 2.54 % ±4.24% ±5.64% ±7.35%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=1 encoding='utf-8' 3.36 % ±5.77% ±7.67% ±9.99%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=0 ignoreBOM=1 encoding='windows-1252' -2.07 % ±6.70% ±8.92% ±11.61%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=0 encoding='iso-8859-3' -0.26 % ±6.37% ±8.48% ±11.04%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=0 encoding='utf-8' -2.52 % ±7.16% ±9.53% ±12.40%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=0 encoding='windows-1252' 6.04 % ±7.72% ±10.28% ±13.38%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=1 encoding='iso-8859-3' -1.99 % ±7.26% ±9.65% ±12.56%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=1 encoding='utf-8' -0.76 % ±7.36% ±9.79% ±12.75%
util/text-decoder.js type='SharedArrayBuffer' n=1000 len=256 fatal=1 ignoreBOM=1 encoding='windows-1252' 4.53 % ±7.85% ±10.45% ±13.60%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=1024 -0.15 % ±0.80% ±1.06% ±1.38%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=256 0.41 % ±2.11% ±2.80% ±3.65%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=32 0.46 % ±0.97% ±1.29% ±1.68%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=8192 0.12 % ±0.27% ±0.37% ±0.48%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=1024 -0.01 % ±0.78% ±1.04% ±1.35%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=256 -0.29 % ±0.74% ±0.98% ±1.28%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=32 0.58 % ±0.96% ±1.27% ±1.66%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=8192 0.02 % ±0.06% ±0.08% ±0.10%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=1024 0.46 % ±0.62% ±0.83% ±1.08%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=256 -0.09 % ±0.84% ±1.12% ±1.45%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=32 -0.26 % ±0.94% ±1.25% ±1.63%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=8192 0.07 % ±0.17% ±0.23% ±0.30%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=1024 0.05 % ±0.58% ±0.77% ±1.01%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=256 0.53 % ±0.66% ±0.88% ±1.15%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=32 -0.26 % ±1.37% ±1.82% ±2.37%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=8192 -0.35 % ±1.15% ±1.52% ±1.98%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=1024 -0.03 % ±0.20% ±0.26% ±0.35%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=256 0.04 % ±0.52% ±0.69% ±0.90%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=32 0.60 % ±1.05% ±1.41% ±1.85%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=8192 -0.00 % ±0.04% ±0.05% ±0.07%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=1024 -0.06 % ±0.19% ±0.26% ±0.34%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=256 0.23 % ±0.42% ±0.56% ±0.73%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=32 -1.52 % ±1.72% ±2.30% ±3.00%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=8192 0.00 % ±0.03% ±0.04% ±0.05%
util/type-check.js n=1000000 argument='false-object' version='js' type='ArrayBufferView' -0.43 % ±1.25% ±1.67% ±2.17%
util/type-check.js n=1000000 argument='false-object' version='js' type='TypedArray' -2.76 % ±3.93% ±5.29% ±7.00%
util/type-check.js n=1000000 argument='false-object' version='js' type='Uint8Array' 0.12 % ±1.33% ±1.77% ±2.30%
util/type-check.js n=1000000 argument='false-object' version='native' type='ArrayBufferView' * -1.79 % ±1.36% ±1.81% ±2.36%
util/type-check.js n=1000000 argument='false-object' version='native' type='TypedArray' -2.20 % ±3.09% ±4.16% ±5.49%
util/type-check.js n=1000000 argument='false-object' version='native' type='Uint8Array' 1.78 % ±2.20% ±2.95% ±3.89%
util/type-check.js n=1000000 argument='false-primitive' version='js' type='ArrayBufferView' -0.66 % ±1.84% ±2.46% ±3.22%
util/type-check.js n=1000000 argument='false-primitive' version='js' type='TypedArray' -0.89 % ±2.98% ±4.00% ±5.26%
util/type-check.js n=1000000 argument='false-primitive' version='js' type='Uint8Array' 0.23 % ±1.24% ±1.65% ±2.15%
util/type-check.js n=1000000 argument='false-primitive' version='native' type='ArrayBufferView' -0.20 % ±2.26% ±3.01% ±3.92%
util/type-check.js n=1000000 argument='false-primitive' version='native' type='TypedArray' 0.12 % ±1.22% ±1.63% ±2.13%
util/type-check.js n=1000000 argument='false-primitive' version='native' type='Uint8Array' -0.16 % ±1.47% ±1.95% ±2.54%
util/type-check.js n=1000000 argument='true' version='js' type='ArrayBufferView' ** -2.66 % ±1.64% ±2.18% ±2.84%
util/type-check.js n=1000000 argument='true' version='js' type='TypedArray' -1.67 % ±1.85% ±2.48% ±3.25%
util/type-check.js n=1000000 argument='true' version='js' type='Uint8Array' 0.27 % ±1.28% ±1.71% ±2.23%
util/type-check.js n=1000000 argument='true' version='native' type='ArrayBufferView' 1.52 % ±3.69% ±4.93% ±6.44%
util/type-check.js n=1000000 argument='true' version='native' type='TypedArray' -0.57 % ±1.29% ±1.72% ±2.24%
util/type-check.js n=1000000 argument='true' version='native' type='Uint8Array' -0.16 % ±1.56% ±2.07% ±2.70%
Landed in 80e3ef3 |
For an arbitrary list of classes, we can protect against userland mutation of the
constructor
prototype property, and speed up theinspect
call by avoiding aObjectGetOwnPropertyDescriptor
call. I tried to come up with a list of classes that are the most likely to be often inspected, though I haven't used any rigorous method, I just came up with it, and I'm certainly open to add/remove some.Refs: #56188 (comment)