Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ updates:
interval: daily
open-pull-requests-limit: 10
versioning-strategy: increase
- package-ecosystem: npm
directory: "/scripts/benchmark"
schedule:
interval: daily
open-pull-requests-limit: 10
versioning-strategy: increase
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/nodejs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
node-version: lts/*
cache: npm
- run: npm ci
- run: npm ci --prefix scripts/benchmark
- run: npm run lint
- run: npm --prefix scripts/benchmark run lint

test:
name: Node ${{ matrix.node }}
Expand All @@ -33,7 +35,7 @@ jobs:
fail-fast: false
matrix:
node:
- '20.19.0'
- '20'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep testing the declared minimum Node release

In the test job, replacing the exact 20.19.0 entry with 20 allows setup-node to select any cached matching Node 20 release, so CI no longer verifies the node >=20.19.0 compatibility promised by package.json. The setup-node v6 documentation confirms that major versions are SemVer specifications distinct from specific versions. If code or a dependency starts relying on behavior added after 20.19.0, all matrix jobs can pass while users on the declared minimum fail; retain 20.19.0 as the lower-bound test.

Useful? React with 👍 / 👎.

- '22'
- '24'
- 'lts/*'
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineConfig([
},
},
{
ignores: ["eslint.config.{js,cjs,mjs}"],
ignores: ["eslint.config.{js,cjs,mjs}", "scripts/benchmark/**"],
},
...feedicFlatConfig,
{
Expand Down
143 changes: 3 additions & 140 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"!**/*.spec.ts"
],
"scripts": {
"benchmark": "node --import=tsx scripts/benchmark.ts",
"benchmark": "npm --prefix scripts/benchmark run benchmark",
"build": "tsc",
"build:docs": "typedoc --hideGenerator src/index.ts",
"build:encode-trie": "node --import=tsx scripts/write-encode-map.ts",
Expand All @@ -62,14 +62,9 @@
"@biomejs/biome": "^2.5.15",
"@eslint/compat": "^2.1.1",
"@feedic/eslint-config": "^0.5.0",
"@types/he": "^1.2.3",
"@types/node": "^26.6.4",
"eslint": "^10.12.0",
"eslint-config-biome": "^2.1.3",
"he": "^1.2.0",
"html-entities": "^2.6.0",
"parse-entities": "^4.0.2",
"tinybench": "^6.2.1",
"tsx": "^4.23.15",
"typedoc": "^0.28.20",
"typescript": "^6.0.3",
Expand Down
16 changes: 15 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,21 @@ entities.decodeHTML("asdf & ÿ ü '"); // "asdf & ÿ ü '"

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.
The tables below are historical measurements of the listed library versions,
including `he` 1.2.0. The current benchmark uses the versions in
`scripts/benchmark/package-lock.json`, including `he` 2.0.0, and does not reproduce
these historical results.

To run the current comparison, use `scripts/benchmark/benchmark.ts`. It requires
Node v22+ and installs benchmark dependencies separately from the main development
dependencies:

```sh
npm ci
npm ci --prefix scripts/benchmark
npm --prefix scripts/benchmark run lint
npm run benchmark
```

### Decoding

Expand Down
4 changes: 2 additions & 2 deletions scripts/benchmark.ts → scripts/benchmark/benchmark.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import he from "he";
import * as he from "he";
import * as htmlEntities from "html-entities";
import { parseEntities } from "parse-entities";
import { Bench } from "tinybench";
import * as entities from "../src/index.js";
import * as entities from "../../src/index.js";

const htmlEntitiesHtml5EncodeOptions: htmlEntities.EncodeOptions = {
level: "html5",
Expand Down
Loading
Loading