FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src: improve windows1252 decoding speed by ChALkeR · Pull Request #61120 · nodejs/node · GitHub

/ node Public

src: improve windows1252 decoding speed - #61120

Closed
ChALkeR wants to merge 3 commits into
nodejs:mainfrom
ChALkeR:chalker/decoder/single-byte/2
Closed

src: improve windows1252 decoding speed#61120
ChALkeR wants to merge 3 commits into
nodejs:mainfrom
ChALkeR:chalker/decoder/single-byte/2

Conversation

ChALkeR commented Dec 19, 2025
edited
Loading

Copy link
Copy Markdown
Member

Tracking: #61041

This builds on top of #61093 and #61118 and gives an additional ~1.4x improvement by using iteration in pairs for this single encoding, as it's commonly used (it's aliased as latin1)

Combined, this is ~114x faster than main on ASCII (due to #61093 + #61118) and ~71x faster than main on non-ASCII

This could be improved further with latin1 checks and by moving ascii checks to prefixes instead, but let #61119 land first

I'm not sure if this even makes sense at this point, it comes at a cost of 128 KiB cache (even though allocated at the first large use)

Perhaps there is some other way or we could ignore this

Warning

Very crude, just a concept demonstration at this point

See #61118 for previous benchmarks

Test Size Throughput Mean Time
Latin lipsum (ASCII) 84.902 KiB 35.45 GiB/s 0.003 ms
Complex 1 79.771 KiB 4.24 GiB/s 0.021 ms

nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Dec 19, 2025
ChALkeR force-pushed the chalker/decoder/single-byte/2 branch from 5b3053e to 7b11e38 Compare December 19, 2025 02:26
Comment thread src/encoding_binding.cc
Comment on lines +425 to +432
if (!tWindows1252x2) {
tWindows1252x2 = (uint32_t *) malloc(256 * 256 * 4); // 256 KiB
for (uint16_t i = 0; i < 256; i++) {
for (uint16_t j = 0; j < 256; j++) {
tWindows1252x2[(i << 8) + j] = (((uint32_t) table[i]) << 16) + table[j];
}
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We’re allocating this table (tWindows1252x2) here for the first time, but we never free it anywhere
This could lead to unnecessary memory usage in long-running processes

I think we should add a cleanup hook right after the allocation, so the table gets freed automatically when the environment shuts down

ChALkeR Dec 19, 2025
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this PR is a crude concept demo

Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

github-actions Bot added the stale label Jul 28, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.

github-actions Bot closed this Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL