Skip to content

Commit aaf04f4

Browse files
anonrigdanielleadams
authored andcommitted
src: replace icu with simdutf for char counts
PR-URL: #46472 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent 2b702c9 commit aaf04f4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/inspector/node_string.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "node_string.h"
22
#include "node/inspector/protocol/Protocol.h"
3+
#include "simdutf.h"
34

45
#include <unicode/unistr.h>
56

@@ -118,9 +119,8 @@ const uint8_t* CharactersUTF8(const String& s) {
118119
}
119120

120121
size_t CharacterCount(const String& s) {
121-
icu::UnicodeString utf16 =
122-
icu::UnicodeString::fromUTF8(icu::StringPiece(s.data(), s.length()));
123-
return utf16.countChar32();
122+
// TODO(@anonrig): Test to make sure CharacterCount returns correctly.
123+
return simdutf::utf32_length_from_utf8(s.data(), s.length());
124124
}
125125

126126
} // namespace StringUtil

0 commit comments

Comments
 (0)