Skip to content

src: add fast path to TextEncoder.encodeInto

Rodrigo Muino Tomonari requested to merge github/fork/anonrig/v8/fast-call into main

Original commit message:

[fastcall] Implement support for onebyte string arguments

Refs: https://github.com/v8/v8/commit/bc831f8ba33b79e2eb670faf1f84c4e39aeb0f9f

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1259/

                                                                                 confidence improvement accuracy (*)    (**)   (***)
util/text-encoder.js op='encodeInto' type='v8-one-byte-string' n=10000 len=0                     1.99 %       ±4.94%  ±6.58%  ±8.57%
util/text-encoder.js op='encodeInto' type='v8-one-byte-string' n=10000 len=1024         ***     13.53 %       ±6.84%  ±9.10% ±11.86%
util/text-encoder.js op='encodeInto' type='v8-one-byte-string' n=10000 len=256                   5.36 %       ±6.97%  ±9.29% ±12.12%
util/text-encoder.js op='encodeInto' type='v8-one-byte-string' n=10000 len=32768        ***     15.07 %       ±7.99% ±10.63% ±13.84%
util/text-encoder.js op='encodeInto' type='v8-two-byte-string' n=10000 len=0                    -5.38 %       ±6.23%  ±8.31% ±10.85%
util/text-encoder.js op='encodeInto' type='v8-two-byte-string' n=10000 len=1024                  1.45 %       ±6.77%  ±9.01% ±11.74%
util/text-encoder.js op='encodeInto' type='v8-two-byte-string' n=10000 len=256                  -2.36 %       ±7.55% ±10.05% ±13.08%
util/text-encoder.js op='encodeInto' type='v8-two-byte-string' n=10000 len=32768                -0.49 %       ±2.34%  ±3.11%  ±4.06%
util/text-encoder.js op='encode' type='v8-one-byte-string' n=10000 len=0                         1.62 %       ±6.95%  ±9.25% ±12.07%
util/text-encoder.js op='encode' type='v8-one-byte-string' n=10000 len=1024                     -2.32 %       ±5.28%  ±7.03%  ±9.17%
util/text-encoder.js op='encode' type='v8-one-byte-string' n=10000 len=256                      -4.58 %       ±6.07%  ±8.08% ±10.54%
util/text-encoder.js op='encode' type='v8-one-byte-string' n=10000 len=32768                     4.25 %      ±11.64% ±15.49% ±20.16%
util/text-encoder.js op='encode' type='v8-two-byte-string' n=10000 len=0                        -6.16 %       ±6.84%  ±9.11% ±11.86%
util/text-encoder.js op='encode' type='v8-two-byte-string' n=10000 len=1024                     -6.52 %       ±7.40%  ±9.85% ±12.83%
util/text-encoder.js op='encode' type='v8-two-byte-string' n=10000 len=256                      -6.35 %       ±6.74%  ±8.97% ±11.68%
util/text-encoder.js op='encode' type='v8-two-byte-string' n=10000 len=32768                    -5.08 %       ±7.21%  ±9.60% ±12.50%

Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 16 comparisons, you can thus
expect the following amount of false-positive results:
  0.80 false positives, when considering a   5% risk acceptance (*, **, ***),
  0.16 false positives, when considering a   1% risk acceptance (**, ***),
  0.02 false positives, when considering a 0.1% risk acceptance (***)

Merge request reports

Loading