GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — util: add fast path for utf8 encoding by anonrig · Pull Request #45412 · nodejs/node

Conversation

@anonrig

@anonrig anonrig commented Nov 10, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Adds a fast path for UTF8. I'll remove my local benchmark and share the Benchmark CI result asap.

Fixes nodejs/performance#3

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

                                                                                                 confidence improvement accuracy (*)    (**)   (***)
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='iso-8859-3'                       -6.27 %       ±8.96% ±11.92% ±15.52%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='latin1'                           -4.62 %       ±8.01% ±10.67% ±13.90%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='utf-8'                    ***     85.34 %      ±11.75% ±15.71% ±20.61%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='iso-8859-3'                        1.61 %       ±8.75% ±11.65% ±15.16%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='latin1'                           -0.09 %      ±10.96% ±14.59% ±19.00%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='utf-8'                    ***     96.26 %      ±11.34% ±15.15% ±19.83%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='iso-8859-3'                         -1.29 %      ±10.21% ±13.59% ±17.69%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='latin1'                             -7.53 %       ±9.26% ±12.32% ±16.03%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='utf-8'                      ***     81.43 %      ±15.18% ±20.26% ±26.49%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='iso-8859-3'                         -3.66 %      ±10.59% ±14.10% ±18.36%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='latin1'                             -4.73 %       ±9.51% ±12.65% ±16.46%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='utf-8'                      ***     66.13 %      ±11.97% ±15.98% ±20.89%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='iso-8859-3'                      -4.66 %       ±7.36%  ±9.81% ±12.80%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='latin1'                          -1.26 %       ±6.54%  ±8.70% ±11.32%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='utf-8'                   ***    124.06 %      ±12.94% ±17.35% ±22.86%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='iso-8859-3'                       3.27 %       ±7.37%  ±9.81% ±12.77%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='latin1'                           4.71 %       ±7.29%  ±9.70% ±12.63%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='utf-8'                   ***    123.17 %      ±11.09% ±14.83% ±19.46%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=0 encoding='iso-8859-3'                             0.89 %      ±11.22% ±14.94% ±19.48%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=0 encoding='latin1'                                -1.94 %       ±9.74% ±12.96% ±16.88%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=0 encoding='utf-8'                                  6.38 %      ±10.23% ±13.62% ±17.75%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=1 encoding='iso-8859-3'                             8.49 %      ±13.25% ±17.64% ±22.99%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=1 encoding='latin1'                                -4.59 %       ±8.69% ±11.56% ±15.05%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=1 encoding='utf-8'                                  3.23 %      ±11.88% ±15.82% ±20.61%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=0 encoding='iso-8859-3'                              -8.39 %      ±11.13% ±14.81% ±19.29%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=0 encoding='latin1'                                  -8.45 %       ±8.95% ±11.94% ±15.59%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=0 encoding='utf-8'                           ***     75.48 %      ±13.57% ±18.10% ±23.65%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=1 encoding='iso-8859-3'                              -8.57 %       ±9.88% ±13.15% ±17.12%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=1 encoding='latin1'                                   0.43 %      ±10.28% ±13.68% ±17.81%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=1 encoding='utf-8'                           ***     61.38 %      ±11.32% ±15.08% ±19.68%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=0 encoding='iso-8859-3'                            1.93 %       ±6.77%  ±9.01% ±11.73%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=0 encoding='latin1'                                1.13 %       ±6.69%  ±8.91% ±11.61%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=0 encoding='utf-8'                          *      5.78 %       ±5.42%  ±7.22%  ±9.41%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=1 encoding='iso-8859-3'                    **     11.05 %       ±7.37%  ±9.82% ±12.82%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=1 encoding='latin1'                               -1.59 %       ±6.92%  ±9.21% ±11.98%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=1 encoding='utf-8'                                 4.86 %       ±6.02%  ±8.01% ±10.44%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='iso-8859-3'                 -3.19 %       ±8.34% ±11.10% ±14.45%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='latin1'                     -3.23 %       ±8.85% ±11.77% ±15.33%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='utf-8'              ***     99.12 %      ±13.72% ±18.35% ±24.08%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='iso-8859-3'                  6.40 %       ±9.11% ±12.12% ±15.78%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='latin1'                     -0.48 %       ±9.58% ±12.75% ±16.59%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='utf-8'              ***     82.03 %      ±10.49% ±14.00% ±18.30%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='iso-8859-3'             *     -9.66 %       ±8.65% ±11.51% ±14.99%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='latin1'                **    -11.56 %       ±7.87% ±10.50% ±13.70%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='utf-8'                ***     79.82 %      ±15.42% ±20.58% ±26.90%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='iso-8859-3'                   -6.23 %      ±10.78% ±14.38% ±18.77%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='latin1'                       -1.80 %       ±7.99% ±10.64% ±13.85%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='utf-8'                ***     86.66 %      ±13.49% ±18.04% ±23.67%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='iso-8859-3'                -2.70 %       ±6.82%  ±9.07% ±11.81%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='latin1'                     0.29 %       ±7.20%  ±9.58% ±12.47%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='utf-8'             ***    117.44 %      ±11.62% ±15.52% ±20.31%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='iso-8859-3'                 3.90 %       ±7.74% ±10.29% ±13.40%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='latin1'                    -2.62 %       ±7.05%  ±9.39% ±12.22%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='utf-8'             ***    112.07 %      ±12.49% ±16.73% ±21.99%

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss, capan, jimmywarting, RaisinTen, gquittet, Meemaw, lynxtaa, lencioni, and styfle reacted with hooray emoji addaleax, gurgunday, bricss, jimmywarting, RaisinTen, Yovach, gquittet, mProjectsCode, CodingKoopa, shahzaibalikhan, and 5 more reacted with rocket emoji
All reactions
  • 🎉 9 reactions
  • 🚀 15 reactions
@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. encoding Issues and PRs related to the TextEncoder and TextDecoder APIs. needs-ci PRs that need a full CI run. labels Nov 10, 2022
@anonrig anonrig added the performance Issues and PRs related to the performance of Node.js. label Nov 10, 2022
addaleax
addaleax reviewed Nov 10, 2022
View reviewed changes
Comment thread src/node_buffer.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/node_buffer.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

@anonrig

anonrig commented Nov 10, 2022

Copy link
Copy Markdown
Member Author

Here's another microbenchmark comparing this branch with Deno & Bun (Benchmarks are available at https://github.com/anonrig/node-benchmarks)

> [email protected] text-decoder
> ~/Developer/node/out/Release/node ./text-decoder/index.mjs && bun run ./text-decoder/index.mjs && deno run -A ./text-decoder/deno.js

cpu: Apple M1 Max
runtime: node v20.0.0-pre (arm64-darwin)

benchmark       time (avg)             (min … max)       p75       p99      p995
-------------------------------------------------- -----------------------------
smallUint8  308.11 ns/iter  (298.87 ns … 331.5 ns) 310.62 ns 331.39 ns  331.5 ns
bigUint8      2.64 µs/iter      (2.6 µs … 2.73 µs)   2.64 µs   2.73 µs   2.73 µs
cpu: Apple M1 Max
runtime: bun 0.2.2 (arm64-darwin)

benchmark       time (avg)             (min … max)       p75       p99      p995
-------------------------------------------------- -----------------------------
smallUint8  213.82 ns/iter (200.47 ns … 461.84 ns) 216.17 ns 227.67 ns 243.92 ns
bigUint8      1.19 µs/iter     (1.07 µs … 1.36 µs)   1.23 µs   1.36 µs   1.36 µs
cpu: Apple M1 Max
runtime: deno 1.27.1 (aarch64-apple-darwin)

benchmark       time (avg)             (min … max)       p75       p99      p995
-------------------------------------------------- -----------------------------
smallUint8  458.98 ns/iter  (439.37 ns … 477.2 ns)    463 ns  476.7 ns  477.2 ns
bigUint8      3.81 µs/iter     (3.74 µs … 3.86 µs)   3.82 µs   3.86 µs   3.86 µs
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig
anonrig force-pushed the perf/utf8-fast-path branch from 5b1d172 to d4222fc Compare November 10, 2022 19:51
addaleax
addaleax approved these changes Nov 10, 2022
View reviewed changes
Trott
Trott approved these changes Nov 10, 2022
View reviewed changes

@Trott Trott left a comment

Copy link
Copy Markdown
Member

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.

LGTM if CI is green. (It's unclear to me if this will break tests or anything when compiled --without-intl but Jenkins CI will check that.)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 10, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 10, 2022
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@anonrig
anonrig force-pushed the perf/utf8-fast-path branch from d4222fc to 3106af1 Compare November 10, 2022 20:51
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 10, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 10, 2022
@nodejs-github-bot

nodejs-github-bot commented Nov 10, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/47848/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

santigimeno
santigimeno reviewed Nov 10, 2022
View reviewed changes
Comment thread src/node_buffer.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

BridgeAR
BridgeAR reviewed Nov 10, 2022
View reviewed changes
Comment thread lib/internal/encoding.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@anonrig anonrig mentioned this pull request Nov 10, 2022
buffer: add asString static method #45408
Closed
@github-actions github-actions Bot mentioned this pull request Nov 11, 2022
CI Reliability 2022-11-11 nodejs/reliability#425
Open
19 tasks
@anonrig
anonrig requested review from BridgeAR and santigimeno November 11, 2022 13:21
@anonrig
anonrig force-pushed the perf/utf8-fast-path branch from 3106af1 to 604ac4f Compare November 11, 2022 13:21
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 11, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 11, 2022
@nodejs-github-bot

nodejs-github-bot commented Nov 11, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/47867/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

santigimeno
santigimeno approved these changes Nov 11, 2022
View reviewed changes
@anonrig
anonrig force-pushed the perf/utf8-fast-path branch from 604ac4f to 10bb1cc Compare November 11, 2022 14:50
@skeeto

skeeto commented Nov 11, 2022

Copy link
Copy Markdown

It calls strncmp on data but is data null terminated? That's potentially an out-of-bounds read (into uninitialized bytes in ArrayBufferViewContents::stack_storage_), and then an overflow on length if it happens to match. ASan would only catch this when length overflows.

--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -591,6 +591,6 @@ void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
 
-  if (!ignore_bom) {
+  if (!ignore_bom && length >= 3) {
     char bom[] = "\xEF\xBB\xBF";
 
-    if (strncmp(data, bom, 3) == 0) {
+    if (memcmp(data, bom, 3) == 0) {
       beginning += 3;
angeloanan reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ruyadorno ruyadorno mentioned this pull request Nov 24, 2022
v19.2.0 proposal #45615
Merged
ruyadorno added a commit that referenced this pull request Nov 24, 2022
@ruyadorno
2022-11-29, Version 19.2.0 (Current)
d2cac02
Notable changes:

buffer:
  * (SEMVER-MINOR) introduce File (Khafra) #45139
deps:
  * update V8 to 10.8.168.20 (Michaël Zasso) #45230
doc:
  * deprecate use of invalid ports in `url.parse` (Antoine du Hamel) #45576
util:
  * add fast path for utf8 encoding (Yagiz Nizipli) #45412

PR-URL: #45615
ruyadorno added a commit that referenced this pull request Nov 25, 2022
@ruyadorno
2022-11-29, Version 19.2.0 (Current)
8a4d7ac
Notable changes:

buffer:
  * (SEMVER-MINOR) introduce File (Khafra) #45139
deps:
  * update timezone to 2022f (Node.js GitHub Bot) #45289
  * update V8 to 10.8.168.20 (Michaël Zasso) #45230
doc:
  * deprecate use of invalid ports in `url.parse` (Antoine du Hamel) #45576
util:
  * add fast path for utf8 encoding (Yagiz Nizipli) #45412

PR-URL: #45615
@anonrig anonrig mentioned this pull request Nov 27, 2022
[v18.x backport] backport utf8 performance improvements #45650
Closed
anonrig added a commit to anonrig/node that referenced this pull request Nov 28, 2022
@anonrig @addaleax
util: add fast path for utf8 encoding
d86c37f
Co-authored-by: Anna Henningsen <[email protected]>
PR-URL: nodejs#45412
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
@anonrig anonrig added lts-watch-v14.x labels Nov 28, 2022
ruyadorno added a commit that referenced this pull request Nov 29, 2022
@ruyadorno
2022-11-29, Version 19.2.0 (Current)
1bbd14e
Notable changes:

buffer:
  * (SEMVER-MINOR) introduce File (Khafra) #45139
deps:
  * update timezone to 2022f (Node.js GitHub Bot) #45289
  * update V8 to 10.8.168.20 (Michaël Zasso) #45230
doc:
  * deprecate use of invalid ports in `url.parse` (Antoine du Hamel) #45576
util:
  * add fast path for utf8 encoding (Yagiz Nizipli) #45412

PR-URL: #45615
@danielleadams danielleadams mentioned this pull request Dec 30, 2022
v18.13.0 release proposal #46025
Merged
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
@anonrig @addaleax @danielleadams
util: add fast path for utf8 encoding
c985310
Co-authored-by: Anna Henningsen <[email protected]>
PR-URL: #45412
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
danielleadams added a commit that referenced this pull request Dec 30, 2022
@danielleadams
2023-01-03, Version 18.13.0 'Hydrogen' (LTS)
cabeade
Notable changes:

Add support for externally shared js builtins:

By default Node.js is built so that all dependencies are bundled into the
Node.js binary itself. Some Node.js distributions prefer to manage dependencies
externally. There are existing build options that allow dependencies with
native code to be externalized. This commit adds additional options so that
dependencies with JavaScript code (including WASM) can also be externalized.
This addition does not affect binaries shipped by the Node.js project but
will allow other distributions to externalize additional dependencies when
needed.

Contributed by Michael Dawson in #44376

fs.watch recursive support on Linux:

`fs.watch` supports recursive watch using the `recursive: true` option.

```js
const watcher = fs.watch(testDirectory, { recursive: true });
watcher.on('change', function(event, filename) {
});
```

Contributed by Yagiz Nizipli in #45098

Support function mocking on Node.js test runner:

The `node:test` module supports mocking during testing via a top-level `mock`
object.

```js
test('spies on an object method', (t) => {
  const number = {
    value: 5,
    add(a) {
      return this.value + a;
    },
  };
  t.mock.method(number, 'add');

  assert.strictEqual(number.add(3), 8);
  assert.strictEqual(number.add.mock.calls.length, 1);
});
```

Contributed by Colin Ihrig in #45326

Other notable changes:

buffer:
  * (SEMVER-MINOR) introduce File (Khafra) #45139
build:
  * disable v8 snapshot compression by default (Joyee Cheung) #45716
crypto:
  * update root certificates (Luigi Pinca) #45490
deps:
  * update ICU to 72.1 (Michaël Zasso) #45068
doc:
  * add doc-only deprecation for headers/trailers setters (Rich Trott) #45697
  * add Rafael to the tsc (Michael Dawson) #45691
  * deprecate use of invalid ports in `url.parse` (Antoine du Hamel) #45576
  * add lukekarrys to collaborators (Luke Karrys) #45180
  * add anonrig to collaborators (Yagiz Nizipli) #45002
  * deprecate url.parse() (Rich Trott) #44919
lib:
  * drop fetch experimental warning (Matteo Collina) #45287
net:
  * (SEMVER-MINOR) add autoSelectFamily and autoSelectFamilyAttemptTimeout options (Paolo Insogna) #44731
* src:
  * (SEMVER-MINOR) add uvwasi version (Jithil P Ponnan) #45639
  * (SEMVER-MINOR) add initial shadow realm support (Chengzhong Wu) #42869
test_runner:
  * (SEMVER-MINOR) add t.after() hook (Colin Ihrig) #45792
  * (SEMVER-MINOR) don't use a symbol for runHook() (Colin Ihrig) #45792
tls:
  * (SEMVER-MINOR) add "ca" property to certificate object (Ben Noordhuis) #44935
  * remove trustcor root ca certificates (Ben Noordhuis) #45776
tools:
  * update certdata.txt (Luigi Pinca) #45490
util:
  * add fast path for utf8 encoding (Yagiz Nizipli) #45412
  * improve textdecoder decode performance (Yagiz Nizipli) #45294
  * (SEMVER-MINOR) add MIME utilities (#21128) (Bradley Farias) #21128

PR-URL: #46025
danielleadams added a commit that referenced this pull request Dec 31, 2022
@danielleadams
2023-01-03, Version 18.13.0 'Hydrogen' (LTS)
c835161
Notable changes:

Add support for externally shared js builtins:

By default Node.js is built so that all dependencies are bundled into the
Node.js binary itself. Some Node.js distributions prefer to manage dependencies
externally. There are existing build options that allow dependencies with
native code to be externalized. This commit adds additional options so that
dependencies with JavaScript code (including WASM) can also be externalized.
This addition does not affect binaries shipped by the Node.js project but
will allow other distributions to externalize additional dependencies when
needed.

Contributed by Michael Dawson in #44376

Introduce `File`:

The File class is part of the [FileAPI](https://w3c.github.io/FileAPI/).
It can be used anywhere a Blob can, for example in `URL.createObjectURL`
and `FormData`. It contains two properties that Blobs do not have: `lastModified`,
the last time the file was modified in ms, and `name`, the name of the file.

Contributed by Khafra in #45139

Support function mocking on Node.js test runner:

The `node:test` module supports mocking during testing via a top-level `mock`
object.

```js
test('spies on an object method', (t) => {
  const number = {
    value: 5,
    add(a) {
      return this.value + a;
    },
  };
  t.mock.method(number, 'add');

  assert.strictEqual(number.add(3), 8);
  assert.strictEqual(number.add.mock.calls.length, 1);
});
```

Contributed by Colin Ihrig in #45326

Other notable changes:

build:
  * disable v8 snapshot compression by default (Joyee Cheung) #45716
crypto:
  * update root certificates (Luigi Pinca) #45490
deps:
  * update ICU to 72.1 (Michaël Zasso) #45068
doc:
  * add doc-only deprecation for headers/trailers setters (Rich Trott) #45697
  * add Rafael to the tsc (Michael Dawson) #45691
  * deprecate use of invalid ports in `url.parse` (Antoine du Hamel) #45576
  * add lukekarrys to collaborators (Luke Karrys) #45180
  * add anonrig to collaborators (Yagiz Nizipli) #45002
  * deprecate url.parse() (Rich Trott) #44919
lib:
  * drop fetch experimental warning (Matteo Collina) #45287
net:
  * (SEMVER-MINOR) add autoSelectFamily and autoSelectFamilyAttemptTimeout options (Paolo Insogna) #44731
* src:
  * (SEMVER-MINOR) add uvwasi version (Jithil P Ponnan) #45639
  * (SEMVER-MINOR) add initial shadow realm support (Chengzhong Wu) #42869
test_runner:
  * (SEMVER-MINOR) add t.after() hook (Colin Ihrig) #45792
  * (SEMVER-MINOR) don't use a symbol for runHook() (Colin Ihrig) #45792
tls:
  * (SEMVER-MINOR) add "ca" property to certificate object (Ben Noordhuis) #44935
  * remove trustcor root ca certificates (Ben Noordhuis) #45776
tools:
  * update certdata.txt (Luigi Pinca) #45490
util:
  * add fast path for utf8 encoding (Yagiz Nizipli) #45412
  * improve textdecoder decode performance (Yagiz Nizipli) #45294
  * (SEMVER-MINOR) add MIME utilities (#21128) (Bradley Farias) #21128

PR-URL: #46025
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@anonrig @addaleax @danielleadams
util: add fast path for utf8 encoding
32a3859
Co-authored-by: Anna Henningsen <[email protected]>
PR-URL: #45412
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
danielleadams added a commit that referenced this pull request Jan 3, 2023
@danielleadams
2023-01-03, Version 18.13.0 'Hydrogen' (LTS)
9902286
Notable changes:

Add support for externally shared js builtins:

By default Node.js is built so that all dependencies are bundled into the
Node.js binary itself. Some Node.js distributions prefer to manage dependencies
externally. There are existing build options that allow dependencies with
native code to be externalized. This commit adds additional options so that
dependencies with JavaScript code (including WASM) can also be externalized.
This addition does not affect binaries shipped by the Node.js project but
will allow other distributions to externalize additional dependencies when
needed.

Contributed by Michael Dawson in #44376

Introduce `File`:

The File class is part of the [FileAPI](https://w3c.github.io/FileAPI/).
It can be used anywhere a Blob can, for example in `URL.createObjectURL`
and `FormData`. It contains two properties that Blobs do not have: `lastModified`,
the last time the file was modified in ms, and `name`, the name of the file.

Contributed by Khafra in #45139

Support function mocking on Node.js test runner:

The `node:test` module supports mocking during testing via a top-level `mock`
object.

```js
test('spies on an object method', (t) => {
  const number = {
    value: 5,
    add(a) {
      return this.value + a;
    },
  };
  t.mock.method(number, 'add');

  assert.strictEqual(number.add(3), 8);
  assert.strictEqual(number.add.mock.calls.length, 1);
});
```

Contributed by Colin Ihrig in #45326

Other notable changes:

build:
  * disable v8 snapshot compression by default (Joyee Cheung) #45716
crypto:
  * update root certificates (Luigi Pinca) #45490
deps:
  * update ICU to 72.1 (Michaël Zasso) #45068
doc:
  * add doc-only deprecation for headers/trailers setters (Rich Trott) #45697
  * add Rafael to the tsc (Michael Dawson) #45691
  * deprecate use of invalid ports in `url.parse` (Antoine du Hamel) #45576
  * add lukekarrys to collaborators (Luke Karrys) #45180
  * add anonrig to collaborators (Yagiz Nizipli) #45002
  * deprecate url.parse() (Rich Trott) #44919
lib:
  * drop fetch experimental warning (Matteo Collina) #45287
net:
  * (SEMVER-MINOR) add autoSelectFamily and autoSelectFamilyAttemptTimeout options (Paolo Insogna) #44731
* src:
  * (SEMVER-MINOR) add uvwasi version (Jithil P Ponnan) #45639
  * (SEMVER-MINOR) add initial shadow realm support (Chengzhong Wu) #42869
test_runner:
  * (SEMVER-MINOR) add t.after() hook (Colin Ihrig) #45792
  * (SEMVER-MINOR) don't use a symbol for runHook() (Colin Ihrig) #45792
tls:
  * (SEMVER-MINOR) add "ca" property to certificate object (Ben Noordhuis) #44935
  * remove trustcor root ca certificates (Ben Noordhuis) #45776
tools:
  * update certdata.txt (Luigi Pinca) #45490
util:
  * add fast path for utf8 encoding (Yagiz Nizipli) #45412
  * improve textdecoder decode performance (Yagiz Nizipli) #45294
  * (SEMVER-MINOR) add MIME utilities (#21128) (Bradley Farias) #21128

PR-URL: #46025
danielleadams added a commit that referenced this pull request Jan 4, 2023
@danielleadams
2023-01-03, Version 18.13.0 'Hydrogen' (LTS)
496f5e7
Notable changes:

Add support for externally shared js builtins:

By default Node.js is built so that all dependencies are bundled into the
Node.js binary itself. Some Node.js distributions prefer to manage dependencies
externally. There are existing build options that allow dependencies with
native code to be externalized. This commit adds additional options so that
dependencies with JavaScript code (including WASM) can also be externalized.
This addition does not affect binaries shipped by the Node.js project but
will allow other distributions to externalize additional dependencies when
needed.

Contributed by Michael Dawson in #44376

Introduce `File`:

The File class is part of the [FileAPI](https://w3c.github.io/FileAPI/).
It can be used anywhere a Blob can, for example in `URL.createObjectURL`
and `FormData`. It contains two properties that Blobs do not have: `lastModified`,
the last time the file was modified in ms, and `name`, the name of the file.

Contributed by Khafra in #45139

Support function mocking on Node.js test runner:

The `node:test` module supports mocking during testing via a top-level `mock`
object.

```js
test('spies on an object method', (t) => {
  const number = {
    value: 5,
    add(a) {
      return this.value + a;
    },
  };
  t.mock.method(number, 'add');

  assert.strictEqual(number.add(3), 8);
  assert.strictEqual(number.add.mock.calls.length, 1);
});
```

Contributed by Colin Ihrig in #45326

Other notable changes:

build:
  * disable v8 snapshot compression by default (Joyee Cheung) #45716
crypto:
  * update root certificates (Luigi Pinca) #45490
deps:
  * update ICU to 72.1 (Michaël Zasso) #45068
doc:
  * add doc-only deprecation for headers/trailers setters (Rich Trott) #45697
  * add Rafael to the tsc (Michael Dawson) #45691
  * deprecate use of invalid ports in `url.parse` (Antoine du Hamel) #45576
  * add lukekarrys to collaborators (Luke Karrys) #45180
  * add anonrig to collaborators (Yagiz Nizipli) #45002
  * deprecate url.parse() (Rich Trott) #44919
lib:
  * drop fetch experimental warning (Matteo Collina) #45287
net:
  * (SEMVER-MINOR) add autoSelectFamily and autoSelectFamilyAttemptTimeout options (Paolo Insogna) #44731
* src:
  * (SEMVER-MINOR) add uvwasi version (Jithil P Ponnan) #45639
  * (SEMVER-MINOR) add initial shadow realm support (Chengzhong Wu) #42869
test_runner:
  * (SEMVER-MINOR) add t.after() hook (Colin Ihrig) #45792
  * (SEMVER-MINOR) don't use a symbol for runHook() (Colin Ihrig) #45792
tls:
  * (SEMVER-MINOR) add "ca" property to certificate object (Ben Noordhuis) #44935
  * remove trustcor root ca certificates (Ben Noordhuis) #45776
tools:
  * update certdata.txt (Luigi Pinca) #45490
util:
  * add fast path for utf8 encoding (Yagiz Nizipli) #45412
  * improve textdecoder decode performance (Yagiz Nizipli) #45294
  * (SEMVER-MINOR) add MIME utilities (#21128) (Bradley Farias) #21128

PR-URL: #46025
danielleadams added a commit that referenced this pull request Jan 5, 2023
@danielleadams
2023-01-05, Version 18.13.0 'Hydrogen' (LTS)
2bb4b59
Notable changes:

Add support for externally shared js builtins:

By default Node.js is built so that all dependencies are bundled into the
Node.js binary itself. Some Node.js distributions prefer to manage dependencies
externally. There are existing build options that allow dependencies with
native code to be externalized. This commit adds additional options so that
dependencies with JavaScript code (including WASM) can also be externalized.
This addition does not affect binaries shipped by the Node.js project but
will allow other distributions to externalize additional dependencies when
needed.

Contributed by Michael Dawson in #44376

Introduce `File`:

The File class is part of the [FileAPI](https://w3c.github.io/FileAPI/).
It can be used anywhere a Blob can, for example in `URL.createObjectURL`
and `FormData`. It contains two properties that Blobs do not have: `lastModified`,
the last time the file was modified in ms, and `name`, the name of the file.

Contributed by Khafra in #45139

Support function mocking on Node.js test runner:

The `node:test` module supports mocking during testing via a top-level `mock`
object.

```js
test('spies on an object method', (t) => {
  const number = {
    value: 5,
    add(a) {
      return this.value + a;
    },
  };
  t.mock.method(number, 'add');

  assert.strictEqual(number.add(3), 8);
  assert.strictEqual(number.add.mock.calls.length, 1);
});
```

Contributed by Colin Ihrig in #45326

Other notable changes:

build:
  * disable v8 snapshot compression by default (Joyee Cheung) #45716
crypto:
  * update root certificates (Luigi Pinca) #45490
deps:
  * update ICU to 72.1 (Michaël Zasso) #45068
doc:
  * add doc-only deprecation for headers/trailers setters (Rich Trott) #45697
  * add Rafael to the tsc (Michael Dawson) #45691
  * deprecate use of invalid ports in `url.parse` (Antoine du Hamel) #45576
  * add lukekarrys to collaborators (Luke Karrys) #45180
  * add anonrig to collaborators (Yagiz Nizipli) #45002
  * deprecate url.parse() (Rich Trott) #44919
lib:
  * drop fetch experimental warning (Matteo Collina) #45287
net:
  * (SEMVER-MINOR) add autoSelectFamily and autoSelectFamilyAttemptTimeout options (Paolo Insogna) #44731
* src:
  * (SEMVER-MINOR) add uvwasi version (Jithil P Ponnan) #45639
  * (SEMVER-MINOR) add initial shadow realm support (Chengzhong Wu) #42869
test_runner:
  * (SEMVER-MINOR) add t.after() hook (Colin Ihrig) #45792
  * (SEMVER-MINOR) don't use a symbol for runHook() (Colin Ihrig) #45792
tls:
  * (SEMVER-MINOR) add "ca" property to certificate object (Ben Noordhuis) #44935
  * remove trustcor root ca certificates (Ben Noordhuis) #45776
tools:
  * update certdata.txt (Luigi Pinca) #45490
util:
  * add fast path for utf8 encoding (Yagiz Nizipli) #45412
  * improve textdecoder decode performance (Yagiz Nizipli) #45294
  * (SEMVER-MINOR) add MIME utilities (#21128) (Bradley Farias) #21128

PR-URL: #46025
@coderabbitai coderabbitai Bot mentioned this pull request Sep 23, 2026
Feature/app completion IEEE-CU/SB-APP#15
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Trott Trott Trott approved these changes
@addaleax addaleax addaleax approved these changes
@BridgeAR BridgeAR Awaiting requested review from BridgeAR
@bnoordhuis bnoordhuis Awaiting requested review from bnoordhuis
@santigimeno santigimeno Awaiting requested review from santigimeno
+1 more reviewer
@N-R-K N-R-K N-R-K left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. encoding Issues and PRs related to the TextEncoder and TextDecoder APIs. needs-ci PRs that need a full CI run. notable-change PRs with changes that should be highlighted in changelogs. performance Issues and PRs related to the performance of Node.js.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uint8Array to UTF8 conversion

Uh oh!

There was an error while loading. Please reload this page.

11 participants

@anonrig @nodejs-github-bot @skeeto @bnoordhuis @Trott @addaleax @santigimeno @BridgeAR @N-R-K @targos @richardlau
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.