From 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7 Mon Sep 17 00:00:00 2001 From: WXL <wl_5969728@163.com> Date: 星期三, 22 四月 2026 18:09:58 +0800 Subject: [PATCH] 上报转运调试 --- node_modules/entities/readme.md | 79 +++++++++++++++++++++++++-------------- 1 files changed, 50 insertions(+), 29 deletions(-) diff --git a/node_modules/entities/readme.md b/node_modules/entities/readme.md index 731d90c..8779612 100644 --- a/node_modules/entities/readme.md +++ b/node_modules/entities/readme.md @@ -4,16 +4,16 @@ ## Features -- 馃槆 Tried and true: `entities` is used by many popular libraries; eg. - [`htmlparser2`](https://github.com/fb55/htmlparser2), the official - [AWS SDK](https://github.com/aws/aws-sdk-js-v3) and - [`commonmark`](https://github.com/commonmark/commonmark.js) use it to - process HTML entities. -- 鈿★笍 Fast: `entities` is the fastest library for decoding HTML entities (as - of April 2022); see [performance](#performance). -- 馃帥 Configurable: Get an output tailored for your needs. You are fine with - UTF8? That'll save you some bytes. Prefer to only have ASCII characters? We - can do that as well! +- 馃槆 Tried and true: `entities` is used by many popular libraries; eg. + [`htmlparser2`](https://github.com/fb55/htmlparser2), the official + [AWS SDK](https://github.com/aws/aws-sdk-js-v3) and + [`commonmark`](https://github.com/commonmark/commonmark.js) use it to process + HTML entities. +- 鈿★笍 Fast: `entities` is the fastest library for decoding HTML entities (as of + September 2025); see [performance](#performance). +- 馃帥 Configurable: Get an output tailored for your needs. You are fine with + UTF8? That'll save you some bytes. Prefer to only have ASCII characters? We + can do that as well! ## How to鈥� @@ -38,15 +38,36 @@ ## Performance -This is how `entities` compares to other libraries on a very basic benchmark -(see `scripts/benchmark.ts`, for 10,000,000 iterations; **lower is better**): +Benchmarked in September 2025 with Node v24.6.0 on Apple M2 using `tinybench`. +Higher ops/s is better; `avg (渭s)` is the mean time per operation. +See `scripts/benchmark.ts` to reproduce. -| Library | Version | `decode` perf | `encode` perf | `escape` perf | -| -------------- | ------- | ------------- | ------------- | ------------- | -| entities | `3.0.1` | 1.418s | 6.786s | 2.196s | -| html-entities | `2.3.2` | 2.530s | 6.829s | 2.415s | -| he | `1.2.0` | 5.800s | 24.237s | 3.624s | -| parse-entities | `3.0.0` | 9.660s | N/A | N/A | +### Decoding + +| Library | Version | ops/s | avg (渭s) | 卤% | slower | +| -------------- | ------- | --------- | -------- | ---- | ------ | +| entities | 7.0.0 | 5,838,416 | 175.57 | 0.06 | 鈥� | +| html-entities | 2.6.0 | 2,919,637 | 347.77 | 0.33 | 50.0% | +| he | 1.2.0 | 2,318,438 | 446.48 | 0.70 | 60.3% | +| parse-entities | 4.0.2 | 852,855 | 1,199.51 | 0.36 | 85.4% | + +### Encoding + +| Library | Version | ops/s | avg (渭s) | 卤% | slower | +| -------------- | ------- | --------- | -------- | ---- | ------ | +| entities | 7.0.0 | 2,770,115 | 368.09 | 0.11 | 鈥� | +| html-entities | 2.6.0 | 1,491,963 | 679.96 | 0.58 | 46.2% | +| he | 1.2.0 | 481,278 | 2,118.25 | 0.61 | 82.6% | + +### Escaping + +| Library | Version | ops/s | avg (渭s) | 卤% | slower | +| -------------- | ------- | --------- | -------- | ---- | ------ | +| entities | 7.0.0 | 4,616,468 | 223.84 | 0.17 | 鈥� | +| he | 1.2.0 | 3,659,301 | 280.76 | 0.58 | 20.7% | +| html-entities | 2.6.0 | 3,555,301 | 296.63 | 0.84 | 23.0% | + +Note: Micro-benchmarks may vary across machines and Node versions. --- @@ -68,8 +89,8 @@ > Why should I use `entities` instead of alternative modules? -As of April 2022, `entities` is a bit faster than other modules. Still, this is -not a very differentiated space and other modules can catch up. +As of September 2025, `entities` is faster than other modules. Still, this is +not a differentiated space and other modules can catch up. **More importantly**, you might already have `entities` in your dependency graph (as a dependency of eg. `cheerio`, or `htmlparser2`), and including it directly @@ -90,15 +111,15 @@ This library wouldn't be possible without the work of these individuals. Thanks to -- [@mathiasbynens](https://github.com/mathiasbynens) for his explanations - about character encodings, and his library `he`, which was one of the - inspirations for `entities` -- [@inikulin](https://github.com/inikulin) for his work on optimized tries for - decoding HTML entities for the `parse5` project -- [@mdevils](https://github.com/mdevils) for taking on the challenge of - producing a quick entity library with his `html-entities` library. - `entities` would be quite a bit slower if there wasn't any competition. - Right now `entities` is on top, but we'll see how long that lasts! +- [@mathiasbynens](https://github.com/mathiasbynens) for his explanations about + character encodings, and his library `he`, which was one of the inspirations + for `entities` +- [@inikulin](https://github.com/inikulin) for his work on optimized tries for + decoding HTML entities for the `parse5` project +- [@mdevils](https://github.com/mdevils) for taking on the challenge of + producing a quick entity library with his `html-entities` library. `entities` + would be quite a bit slower if there wasn't any competition. Right now + `entities` is on top, but we'll see how long that lasts! --- -- Gitblit v1.9.3