Skip to content

Conversation

@ChALkeR
Copy link
Member

@ChALkeR ChALkeR commented Dec 19, 2025

Tracking: #61041

Don't expect buffer.isAscii common-case to be ASCII, as that's exposed as a public API for checks.
The error version has better performance on non-ascii as it returns early, which could easily be e.g. >10x.

Refs: #46271 (comment),

But somehow the _errors version is also faster on ASCII, which was supposed to be a common case for validate_ascii?
I'm not sure what's up, might be a simdutf bug? cc @lemire

On another note: v8 is also likely using validate_ascii incorrectly

buffer.isAscii perf:

main:

Test Size Throughput Mean Time
Latin lipsum (ASCII) 84.902 KiB 105.08 GiB/s 0.001 ms
Arabic lipsum 79.771 KiB 103.88 GiB/s 0.001 ms
Chinese lipsum 68.203 KiB 101.78 GiB/s 0.001 ms

PR

Test Size Throughput Mean Time
Latin lipsum (ASCII) 84.902 KiB 117.97 GiB/s 0.001 ms
Arabic lipsum 79.771 KiB 1836.47 GiB/s 0.000 ms
Chinese lipsum 68.203 KiB 1564.76 GiB/s 0.000 ms
@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++. needs-ci PRs that need a full CI run. labels Dec 19, 2025
@ChALkeR ChALkeR marked this pull request as ready for review December 19, 2025 09:50
@ChALkeR ChALkeR changed the title src: use validate_ascii_with_errors instead of validate_asci src: use validate_ascii_with_errors instead of validate_ascii Dec 19, 2025
@ChALkeR ChALkeR changed the title src: use validate_ascii_with_errors instead of validate_ascii src: use validate_ascii_with_errors for buffer.isAscii Dec 19, 2025
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (4f24aff) to head (e78cdd1).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@ ## main #61122 +/- ## ========================================== - Coverage 88.53% 88.52% -0.02%  ========================================== Files 703 703 Lines 208546 208547 +1 Branches 40217 40217 ========================================== - Hits 184634 184607 -27  - Misses 15926 15949 +23  - Partials 7986 7991 +5 
Files with missing lines Coverage Δ
src/node_buffer.cc 68.90% <100.00%> (+0.03%) ⬆️

... and 46 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Copy link
Member

@lemire lemire left a comment

Choose a reason for hiding this comment

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

Thanks for the ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

4 participants