From 79fb8cbcf561c80b84a855c6a1628ffb71803ecf Mon Sep 17 00:00:00 2001 From: Nikita Skovoroda Date: Tue, 3 Mar 2026 02:03:43 +0300 Subject: [PATCH] src: use validate_ascii_with_errors instead of validate_ascii MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It has better performance PR-URL: https://github.com/nodejs/node/pull/61122 Reviewed-By: Colin Ihrig Reviewed-By: Daniel Lemire Reviewed-By: Rafael Gonzaga Reviewed-By: Gürgün Dayıoğlu Reviewed-By: Anna Henningsen --- src/node_buffer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index d4a63cf610c..e40a21288ee 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -1252,7 +1252,8 @@ static void IsAscii(const FunctionCallbackInfo& args) { env, "Cannot validate on a detached buffer"); } - args.GetReturnValue().Set(simdutf::validate_ascii(abv.data(), abv.length())); + args.GetReturnValue().Set( + !simdutf::validate_ascii_with_errors(abv.data(), abv.length()).error); } void SetBufferPrototype(const FunctionCallbackInfo& args) {